File indexing completed on 2024-12-22 04:17:47
0001 /*************************************************************************** 0002 * * 0003 * copyright : (C) 2008 The University of Toronto * 0004 * netterfield@astro.utoronto.ca * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 ***************************************************************************/ 0012 0013 #include "viewdialog.h" 0014 0015 #include "view.h" 0016 #include "filltab.h" 0017 #include "dialogpage.h" 0018 #include "document.h" 0019 #include "mainwindow.h" 0020 #include "application.h" 0021 #include "dialogdefaults.h" 0022 0023 #include <QBrush> 0024 #include <QDebug> 0025 0026 namespace Kst { 0027 0028 ViewDialog::ViewDialog(View *view, QWidget *parent) 0029 : Dialog(parent), _view(view) { 0030 0031 setWindowTitle(tr("Edit View")); 0032 0033 _fillTab = new FillTab(this); 0034 0035 connect(_fillTab, SIGNAL(apply()), this, SLOT(fillChanged())); 0036 0037 _saveAsDefault->show(); 0038 0039 DialogPage *fill = new DialogPage(this); 0040 fill->setPageTitle(tr("Fill")); 0041 fill->addDialogTab(_fillTab); 0042 addDialogPage(fill); 0043 0044 setupFill(); 0045 0046 selectDialogPage(fill); 0047 0048 } 0049 0050 0051 ViewDialog::~ViewDialog() { 0052 } 0053 0054 0055 void ViewDialog::setupFill() { 0056 Q_ASSERT(_view); 0057 QBrush b = _view->backgroundBrush(); 0058 0059 _fillTab->initialize(&b); 0060 } 0061 0062 void ViewDialog::fillChanged() { 0063 Q_ASSERT(_view); 0064 0065 QBrush b = _fillTab->brush(_view->backgroundBrush()); 0066 0067 kstApp->mainWindow()->document()->setChanged(true); 0068 _view->setBackgroundBrush(b); 0069 0070 if (_saveAsDefault->isChecked()) { 0071 saveDialogDefaultsBrush(View::staticDefaultsGroupName(), _view->backgroundBrush()); 0072 } 0073 } 0074 0075 } 0076 0077 // vim: ts=2 sw=2 et