23#include <tqworkspace.h>
27#include <tqobjectlist.h>
28#include <tqstylefactory.h>
29#include <tqmetaobject.h>
31#include <tqvaluevector.h>
35#include <kiconloader.h>
36#include <tdepopupmenu.h>
37#include <kstdaction.h>
39#include <kxmlguiclient.h>
40#include <tdemainwindow.h>
41#include <tdemessagebox.h>
44#include <tdeactionclasses.h>
45#include <tdeapplication.h>
47#include <tdeglobalsettings.h>
48#include <kdialogbase.h>
50#include <ktabwidget.h>
51#include <tdefontdialog.h>
53#if !defined(TQ_WS_WIN)
54# include <tdeactioncollection.h>
57#include "widgetpropertyset.h"
58#include "objecttree.h"
59#include "widgetlibrary.h"
63#include "objecttreeview.h"
65#include "tabstopdialog.h"
66#include "connectiondialog.h"
67#include "pixmapcollection.h"
70#include "kfdpixmapedit.h"
71#include <koproperty/editor.h>
72#include <koproperty/property.h>
73#include <koproperty/factory.h>
75#include "formmanager.h"
82class PropertyFactory : public KoProperty::CustomPropertyFactory
85 PropertyFactory(TQObject *parent)
86 : KoProperty::CustomPropertyFactory(parent)
90 virtual ~PropertyFactory() {}
92 KoProperty::CustomProperty* createCustomProperty(KoProperty::Property *) { return 0;}
94 KoProperty::Widget* createCustomWidget(KoProperty::Property *prop)
96 return new KFDPixmapEdit(prop);
104static KStaticDeleter<FormManager> m_managerDeleter;
108 : TQObject(parent, name)
113 , m_objectBlockingPropertyEditorUpdating(0)
117#ifdef KEXI_STANDALONE
118 TDEGlobal::locale()->insertCatalogue( "standalone_kformdesigner");
120 TDEGlobal::locale()->insertCatalogue( "kformdesigner");
123 connect( kapp, TQ_SIGNAL( settingsChanged( int) ), TQ_SLOT( slotSettingsChanged( int) ) );
124 slotSettingsChanged(TDEApplication::SETTINGS_SHORTCUTS);
127 m_propSet = new WidgetPropertySet( this);
132 m_drawingSlot = false;
138 m_domDoc.appendChild(m_domDoc.createElement( "UI"));
140 m_deleteWidgetLater_list.setAutoDelete( true);
141 connect( &m_deleteWidgetLater_timer, TQ_SIGNAL(timeout()), this, TQ_SLOT(deleteWidgetLaterTimeout()));
146 KoProperty::FactoryManager::self()->registerFactoryForEditor(KoProperty::Pixmap,
147 new PropertyFactory(KoProperty::FactoryManager::self()));
150FormManager::~FormManager()
152 m_managerDeleter.setObject(_self, 0, false);
156 delete m_uiCodeDialog;
171 m_managerDeleter.setObject( _self, m );
181 editor->changeSet(m_propSet->set());
187 m_treeview = treeview;
189 connect(m_propSet, TQ_SIGNAL(widgetNameChanged( const TQCString&, const TQCString&)),
190 m_treeview, TQ_SLOT(renameItem( const TQCString&, const TQCString&)));
196 m_collection = collection;
200 if (m_options & HideSignalSlotConnections)
201 m_dragConnection = 0;
203 m_dragConnection = new TDEToggleAction(i18n( "Connect Signals/Slots"),
207 m_dragConnection->setExclusiveGroup( "LibActionWidgets");
208 m_dragConnection->setChecked( false);
209 actions.append(m_dragConnection);
212 m_pointer = new TDEToggleAction(i18n( "Pointer"), "mouse_pointer", TDEShortcut(0),
214 m_pointer->setExclusiveGroup( "LibActionWidgets");
215 m_pointer->setChecked( true);
216 actions.append(m_pointer);
218 m_snapToGrid = new TDEToggleAction(i18n( "Snap to Grid"), TQString(), TDEShortcut(0),
219 0, 0, m_collection, "snap_to_grid");
220 m_snapToGrid->setChecked( true);
221 actions.append(m_snapToGrid);
224 TDESelectAction *m_style = new TDESelectAction( i18n( "Style"), TDEShortcut(0),
225 this, TQ_SLOT( slotStyle()), m_collection, "change_style");
226 m_style->setEditable( false);
228 TDEGlobal::config()->setGroup( "General");
229 TQString currentStyle = TQString::fromLatin1(kapp->style().name()).lower();
230 const TQStringList styles = TQStyleFactory::keys();
231 m_style->setItems(styles);
232 m_style->setCurrentItem(0);
234 TQStringList::ConstIterator endIt = styles.constEnd();
236 for (TQStringList::ConstIterator it = styles.constBegin(); it != endIt; ++it, ++idx)
238 if ((*it).lower() == currentStyle) {
239 m_style->setCurrentItem(idx);
244 m_style->setToolTip(i18n( "Set the current view style."));
245 m_style->setMenuAccelsEnabled( true);
246 actions.append(m_style);
248 lib->addCustomWidgetActions(m_collection);
254FormManager::isPasteEnabled()
256 return m_domDoc.namedItem( "UI").hasChildNodes();
288 for(form = m_forms.first(); form; form = m_forms.next())
292 form-> widget()->setCursor(TQCursor(CrossCursor));
293 TQObjectList *l = form-> widget()->queryList( "TQWidget" );
294 for(TQObject *o = l->first(); o; o = l->next())
296 if( ((TQWidget*)o)->ownCursor() )
299 form->d->cursors.insert(o, static_cast<TQWidget* >(o)->cursor());
300 static_cast<TQWidget* >(o)->setCursor(TQCursor(TQt::CrossCursor));
307 m_selectedClass = classname;
308 m_pointer->setChecked( false);
321 for(form = m_forms.first(); form; form = m_forms.next())
323 form-> widget()->unsetCursor();
324 TQObjectList *l = form-> widget()->queryList( "TQWidget" );
325 for(TQObject *o = l->first(); o; o = l->next())
327 static_cast<TQWidget* >(o)->unsetCursor();
329 if( ((TQWidget*)o)->ownCursor()) {
330 TQMap<TQObject*,TQCursor>::ConstIterator curIt( form->d->cursors.find(o) );
331 if (curIt!=form->d->cursors.constEnd())
332 static_cast<TQWidget* >(o)->setCursor( *curIt );
343 m_pointer->setChecked( true);
351 else if(m_dragConnection)
358 if (m_options & HideSignalSlotConnections)
366 for(form = m_forms.first(); form; form = m_forms.next())
369 form->d->mouseTrackers = new TQStringList();
372 form-> widget()->setCursor(TQCursor(PointingHandCursor));
373 form-> widget()->setMouseTracking( true);
375 TQObjectList *l = form-> widget()->queryList( "TQWidget" );
376 for(TQObject *o = l->first(); o; o = l->next())
378 TQWidget *w = static_cast<TQWidget* >(o);
381 form->d->cursors.insert(w, w->cursor());
383 w->setCursor(TQCursor(PointingHandCursor ));
385 if(w->hasMouseTracking())
386 form->d->mouseTrackers->append(w->name());
387 w->setMouseTracking( true);
392 m_connection = new Connection();
393 m_drawingSlot = true;
394 if (m_dragConnection)
395 m_dragConnection->setChecked( true);
401 if (m_options & HideSignalSlotConnections)
405 m_connection = new Connection();
407 if(m_active && m_active->formWidget()) {
408 Form *ff = (Form*)m_active;
414 if (m_active && m_active->widget())
415 m_active->widget()->repaint();
421 if (m_options & HideSignalSlotConnections)
426 if(m_active && m_active->formWidget())
427 m_active->formWidget()->clearForm();
430 for(form = m_forms.first(); form; form = m_forms.next())
432 form-> widget()->unsetCursor();
433 form-> widget()->setMouseTracking( false);
434 TQObjectList *l = form-> widget()->queryList( "TQWidget" );
435 for(TQObject *o = l->first(); o; o = l->next())
437 TQWidget *w = (TQWidget*)o;
438 if( w->ownCursor()) {
439 TQMap<TQObject*,TQCursor>::ConstIterator curIt( form->d->cursors.find(o) );
440 if (curIt!=form->d->cursors.constEnd())
441 static_cast<TQWidget* >(o)->setCursor( *curIt );
444 w->setMouseTracking( !form->d->mouseTrackers->grep(w->name()).isEmpty() );
449 delete (form->d->mouseTrackers);
450 form->d->mouseTrackers = 0;
453 if(m_connection->slot().isNull())
457 m_drawingSlot = false;
458 m_pointer->setChecked( true);
464 return m_snapToGrid->isChecked();
470 kdDebug() << "FormManager::windowChanged("
471 << (w ? (TQString(w->className())+ " "+w->name()) : TQString( "0")) << ")" << endl;
477 m_treeview->setForm(0);
482 emitNoFormSelected();
486 Form *previousActive = m_active;
488 for(form = m_forms.first(); form; form = m_forms.next())
493 m_treeview->setForm(form);
497 kdDebug() << "FormManager::windowChanged() active form is " << form-> objectTree()->name() << endl;
503 TDESelectAction *m_style = (TDESelectAction*)m_collection->action( "change_style", "TDESelectAction");
504 const TQString currentStyle = form-> widget()->style().name();
505 const TQStringList styles = m_style->items();
508 TQStringList::ConstIterator endIt = styles.constEnd();
509 for (TQStringList::ConstIterator it = styles.constBegin(); it != endIt; ++it, ++idx)
511 if ((*it).lower() == currentStyle) {
512 kdDebug() << "Updating the style to " << currentStyle << endl;
513 m_style->setCurrentItem(idx);
525 emit dirty(form, form->isModified());
527 m_active->emitActionSignals();
536 for(form = m_preview.first(); form; form = m_preview.next())
538 kdDebug() << (form-> widget() ? form-> widget()->name() : "") << endl;
540 kdDebug() << "FormManager::windowChanged() active preview form is " << form-> widget()->name() << endl;
546 TDESelectAction *m_style = (TDESelectAction*)m_collection->action( "change_style", "TDESelectAction");
547 const TQString currentStyle = form-> widget()->style().name();
548 const TQStringList styles = m_style->items();
551 TQStringList::ConstIterator endIt = styles.constEnd();
552 for (TQStringList::ConstIterator it = styles.constBegin(); it != endIt; ++it, ++idx)
554 if ((*it).lower() == currentStyle) {
555 kdDebug() << "Updating the style to " << currentStyle << endl;
556 m_style->setCurrentItem(idx);
565 emit dirty(form, false);
566 emitNoFormSelected();
584 for(Form *form = m_forms.first(); form; form = m_forms.next()) {
585 if(form->toplevelContainer() && form->widget() == w)
597 if(m_forms.find(form) == -1)
598 m_preview.remove(form);
600 m_forms.remove(form);
602 if(m_forms.count() == 0) {
615 m_preview.append(form);
623 m_forms.append(form);
626 m_treeview->setForm(form);
630 connect(form, TQ_SIGNAL(selectionChanged(TQWidget*, bool, bool)),
631 m_propSet, TQ_SLOT(setSelectedWidgetWithoutReload(TQWidget*, bool, bool)));
634 connect(form, TQ_SIGNAL(selectionChanged(TQWidget*, bool, bool)),
635 m_treeview, TQ_SLOT(setSelectedWidget(TQWidget*, bool)));
639 connect(m_propSet, TQ_SIGNAL(widgetNameChanged( const TQCString&, const TQCString&)),
640 form, TQ_SLOT(changeName( const TQCString&, const TQCString&)));
649 if(!form || !container || !form-> objectTree())
651 TQDomDocument domDoc;
662 container->setStyle( &(form-> widget()->style()) );
670 m_preview.append(myform);
700 return (!item->parent());
713 if ( activeForm()->widget() == list->first()) {
735 m_domDoc.setContent(TQString(), true);
736 TQDomElement parent = m_domDoc.createElement( "UI");
737 m_domDoc.appendChild(parent);
740 for(w = list->first(); w; w = list->next())
764 KCommand *com = new CutWidgetCommand(*list, activeForm());
771 if(!m_domDoc.namedItem( "UI").hasChildNodes())
789 m_sigSlotMenu = new TDEPopupMenu();
790 m_sigSlotMenu->insertTitle(SmallIcon( "connection"), i18n( "Signals"));
792 TQStrList list = w->metaObject()->signalNames( true);
793 TQStrListIterator it(list);
794 for(; it.current() != 0; ++it)
795 m_sigSlotMenu->insertItem(*it);
797 int result = m_sigSlotMenu->exec(TQCursor::pos());
803 delete m_sigSlotMenu;
810 m_sigSlotMenu = new TDEPopupMenu();
811 m_sigSlotMenu->insertTitle(SmallIcon( "connection"), i18n( "Slots"));
813 TQString signalArg( m_connection->signal().remove( TQRegExp( ".*[(]|[)]") ) );
815 TQStrList list = w->metaObject()->slotNames( true);
816 TQStrListIterator it(list);
817 for(; it.current() != 0; ++it)
820 TQString slotArg(*it);
821 slotArg = slotArg.remove( TQRegExp( ".*[(]|[)]") );
822 if(!signalArg.startsWith(slotArg, true))
825 m_sigSlotMenu->insertItem(*it);
828 int result = m_sigSlotMenu->exec(TQCursor::pos());
834 delete m_sigSlotMenu;
845 const bool multiple = widgetsCount > 1;
848 const bool enableLayout = multiple || w == container-> widget();
851 TQString n = container-> form()-> library()->displayName(w->className());
855 m_popup = new TDEPopupMenu();
865 m_popup->insertTitle(SmallIcon( "form"), i18n( "%1 : Form").arg(w->name()) );
867 m_popup->insertTitle( SmallIcon(
868 container-> form()-> library()->iconName(w->className())), TQString(w->name()) + " : " + n );
871 m_popup->insertTitle(SmallIcon( "multiple_obj"), i18n( "Multiple Widgets")
872 + TQString( " (%1)").arg(widgetsCount));
875#define PLUG_ACTION(_name, forceVisible) \
876 { a = action(_name); \
877 if (a && (forceVisible || a->isEnabled())) { \
878 if (separatorNeeded) \
879 m_popup->insertSeparator(); \
880 separatorNeeded = false; \
885 bool separatorNeeded = false;
887 PLUG_ACTION( "edit_cut", !toplevelWidgetSelected);
888 PLUG_ACTION( "edit_copy", !toplevelWidgetSelected);
889 PLUG_ACTION( "edit_paste", true);
890 PLUG_ACTION( "edit_delete", !toplevelWidgetSelected);
891 separatorNeeded = true;
892 PLUG_ACTION( "layout_menu", enableLayout);
893 PLUG_ACTION( "break_layout", enableLayout);
894 separatorNeeded = true;
895 PLUG_ACTION( "align_menu", !toplevelWidgetSelected);
896 PLUG_ACTION( "adjust_size_menu", !toplevelWidgetSelected);
897 separatorNeeded = true;
900 if(!multiple && w->inherits( "TQLabel") && ((TQLabel*)w)->text().contains( "&") && (((TQLabel*)w)->textFormat() != RichText))
903 m_popup->insertSeparator();
905 TDEPopupMenu *sub = new TDEPopupMenu(w);
906 TQWidget *buddy = ((TQLabel*)w)->buddy();
908 sub->insertItem(i18n( "No Buddy"), MenuNoBuddy);
910 sub->setItemChecked(MenuNoBuddy, true);
911 sub->insertSeparator();
916 int index = sub->insertItem(
917 SmallIcon(container-> form()-> library()->iconName(it.current()->className().latin1())),
918 it.current()->name());
919 if(it.current()->widget() == buddy)
920 sub->setItemChecked(index, true);
923 m_popup->insertItem(i18n( "Choose Buddy..."), sub);
925 connect(sub, TQ_SIGNAL(activated( int)), this, TQ_SLOT( buddyChosen( int)));
927 separatorNeeded = true;
932 if(!multiple && !(m_options & HideEventsInPopupMenu))
935 m_popup->insertSeparator();
938 TDEPopupMenu *sigMenu = new TDEPopupMenu();
939 TQStrList list = w->metaObject()->signalNames( true);
940 TQStrListIterator it(list);
941 for(; it.current() != 0; ++it)
942 sigMenu->insertItem(*it);
944 int id = m_popup->insertItem(SmallIconSet( ""), i18n( "Events"), sigMenu);
947 m_popup->setItemEnabled( id, false);
948 connect(sigMenu, TQ_SIGNAL(activated( int)), this, TQ_SLOT( menuSignalChosen( int)));
949 separatorNeeded = true;
957 if (separatorNeeded) {
958 lastID = m_popup->insertSeparator();
960 const uint oldIndex = m_popup->count()-1;
961 container-> form()-> library()->createMenuActions(w->className(), w, m_popup, container);
962 if (oldIndex == (m_popup->count()-1)) {
969 if (separatorNeeded) {
970 m_popup->removeItem( lastID );
979 popupPos = TQCursor::pos();
984 popupPos = sel_w ? sel_w->mapToGlobal(TQPoint(sel_w->width()/2, sel_w->height()/2)) : TQCursor::pos();
986 m_insertPoint = container-> widget()->mapFromGlobal(popupPos);
987 m_popup->exec(popupPos);
988 m_insertPoint = TQPoint();
1000 TQLabel *label = static_cast<TQLabel* >((TQWidget*)m_menuWidget);
1002 if( id == MenuNoBuddy)
1009 if(!item || !item->widget())
1011 label->setBuddy(item->widget());
1017 if (m_options & HideSignalSlotConnections)
1022 if(m_drawingSlot && m_sigSlotMenu)
1024 if( m_connection->receiver().isNull() )
1025 m_connection->setSignal(m_sigSlotMenu->text( id));
1028 m_connection->setSlot(m_sigSlotMenu->text( id));
1029 kdDebug() << "Finished creating the connection: sender=" << m_connection->sender() << "; signal=" << m_connection->signal() <<
1030 "; receiver=" << m_connection->receiver() << "; slot=" << m_connection->slot() << endl;
1035 else if(m_menuWidget)
1036 emit createFormSlot(m_active, m_menuWidget->name(), m_popup->text( id));
1040FormManager::slotConnectionCreated( Form *form, Connection &connection)
1042 if (m_options & HideSignalSlotConnections)
1047 Connection *c = new Connection(connection);
1048 form->connectionBuffer()->append(c);
1096 WidgetList *list = m_active->selectedWidgets();
1098 if (list->isEmpty()) {
1099 kdWarning() << "FormManager::createLayout(): list is empty!" << endl;
1102 if(list->count() == 1)
1104 ObjectTreeItem *item = m_active->objectTree()->lookup(list->first()->name());
1105 if(!item || !item-> container() || !m_propSet->contains( "layout"))
1111 TQWidget *parent = list->first()->parentWidget();
1112 for(TQWidget *w = list->first(); w; w = list->next())
1114 kdDebug() << "comparing widget " << w->name() << " whose parent is " << w->parentWidget()->name() << " insteaed of " << parent->name() << endl;
1115 if(w->parentWidget() != parent)
1117 KMessageBox::sorry(m_active->widget()->topLevelWidget(), i18n( "<b>Cannot create the layout.</b>\n"
1118 "All selected widgets must have the same parent."));
1119 kdDebug() << "FormManager::createLayout() widgets don't have the same parent widget" << endl;
1125 m_active->addCommand(com, true);
1135 TQCString c( container-> widget()->className() );
1137 if((c == "Grid") || (c == "VBox") || (c == "HBox") || (c == "HFlow") || (c == "VFlow"))
1140 m_active->addCommand(com, true);
1144 if( activeForm()->selectedWidgets()->count() == 1)
1145 (*m_propSet)[ "layout"] = "NoLayout";
1147 container-> setLayout(Container::NoLayout);
1154 if (m_objectBlockingPropertyEditorUpdating)
1168FormManager::blockPropertyEditorUpdating( void *blockingObject)
1170 if (!blockingObject || m_objectBlockingPropertyEditorUpdating)
1172 m_objectBlockingPropertyEditorUpdating = blockingObject;
1176FormManager::unblockPropertyEditorUpdating( void *blockingObject, WidgetPropertySet *set)
1178 if (!blockingObject || m_objectBlockingPropertyEditorUpdating!=blockingObject)
1181 m_objectBlockingPropertyEditorUpdating = 0;
1190 TQWidget *topLevel = m_active->widget()->topLevelWidget();
1193 if (dlg.exec(m_active) == TQDialog::Accepted) {
1198 emit dirty(m_active, true);
1208 TDESelectAction *m_style = (TDESelectAction*)m_collection->action( "change_style", "TDESelectAction");
1209 TQString style = m_style->currentText();
1213 for(TQObject *o = l->first(); o; o = l->next())
1214 ( static_cast<TQWidget* >(o))->setStyle( style );
1231 if (m_options & HideSignalSlotConnections)
1250 if(w->parentWidget() != parentWidget)
1252 kdDebug() << "FormManager::alignWidgets() type ==" << type << " widgets don't have the same parent widget" << endl;
1262FormManager::alignWidgetsToLeft()
1268FormManager::alignWidgetsToRight()
1274FormManager::alignWidgetsToTop()
1280FormManager::alignWidgetsToBottom()
1296FormManager::alignWidgetsToGrid()
1306FormManager::adjustSizeToGrid()
1356FormManager::bringWidgetToFront()
1366FormManager::sendWidgetToBack()
1404 w->reparent(0, WType_TopLevel, TQPoint(0,0));
1405 m_deleteWidgetLater_list.append( w );
1406 m_deleteWidgetLater_timer.start( 100, true );
1410FormManager::deleteWidgetLaterTimeout()
1412 m_deleteWidgetLater_list.clear();
1418#ifdef KEXI_DEBUG_GUI
1428 if (!m_uiCodeDialog) {
1429 m_uiCodeDialog = new KDialogBase(0, "uiwindow", true, i18n( "Form's UI Code"),
1430 KDialogBase::Close, KDialogBase::Close);
1431 m_uiCodeDialog->resize(700, 600);
1432 TQVBox *box = m_uiCodeDialog->makeVBoxMainWidget();
1433 KTabWidget* tab = new KTabWidget(box);
1435 m_currentUICodeDialogEditor = new KTextEdit(TQString(), TQString(), tab);
1436 tab->addTab( m_currentUICodeDialogEditor, i18n( "Current"));
1437 m_currentUICodeDialogEditor->setReadOnly( true);
1438 TQFont f( m_currentUICodeDialogEditor->font() );
1439 f.setFamily( "courier");
1440 m_currentUICodeDialogEditor->setFont(f);
1441 m_currentUICodeDialogEditor->setTextFormat(TQt::PlainText);
1443 m_originalUICodeDialogEditor = new KTextEdit(TQString(), TQString(), tab);
1444 tab->addTab( m_originalUICodeDialogEditor, i18n( "Original"));
1445 m_originalUICodeDialogEditor->setReadOnly( true);
1446 m_originalUICodeDialogEditor->setFont(f);
1447 m_originalUICodeDialogEditor->setTextFormat(TQt::PlainText);
1449 m_currentUICodeDialogEditor->setText( uiCode );
1452 doc.setContent( activeForm()->m_recentlyLoadedUICode );
1453 m_originalUICodeDialogEditor->setText( doc.toString( 3 ) );
1454 m_uiCodeDialog->show();
1459FormManager::slotSettingsChanged( int category)
1461 if (category==TDEApplication::SETTINGS_SHORTCUTS) {
1462 m_contextMenuKey = TDEGlobalSettings::contextMenuKey();
1467FormManager::emitWidgetSelected( KFormDesigner::Form* form, bool multiple )
1469 enableFormActions();
1493 bool fontEnabled = false;
1495 if (-1 != it.current()->metaObject()->findProperty( "font", true)) {
1503 bool containerSelected = false;
1506 KFormDesigner::ObjectTreeItem *item = 0;
1510 containerSelected = true;
1514 enableAction( "layout_menu", multiple || containerSelected);
1515 enableAction( "layout_hbox", multiple || containerSelected);
1516 enableAction( "layout_vbox", multiple || containerSelected);
1517 enableAction( "layout_grid", multiple || containerSelected);
1529FormManager::emitFormWidgetSelected( KFormDesigner::Form* form )
1549 enableFormActions();
1552 const bool hasChildren = !form-> objectTree()->children()->isEmpty();
1567FormManager::emitNoFormSelected()
1569 disableWidgetActions();
1578 if (!(m_options & HideSignalSlotConnections))
1584 if (!(m_options & SkipFileActions)) {
1594FormManager::enableFormActions()
1598 if (!(m_options & HideSignalSlotConnections))
1604 if (!(m_options & SkipFileActions)) {
1615FormManager::disableWidgetActions()
1643FormManager::emitUndoEnabled( bool enabled, const TQString &text)
1650FormManager::emitRedoEnabled( bool enabled, const TQString &text)
1661 WidgetList *wlist = m_active->selectedWidgets();
1665 bool oneFontSelected = true;
1667 if (m_active->library()->isPropertyVisible(widget->className(), widget, "font")) {
1668 widgetsWithFontProperty.append(widget);
1669 if (oneFontSelected) {
1670 if (widgetsWithFontProperty.count()==1)
1671 font = widget->font();
1672 else if (font != widget->font())
1673 oneFontSelected = false;
1677 if (widgetsWithFontProperty.isEmpty())
1679 if (!oneFontSelected)
1680 font = m_active->widget()->font();
1682 if (1==widgetsWithFontProperty.count()) {
1684 widget = widgetsWithFontProperty.first();
1685 KoProperty::Property &fontProp = m_propSet->property( "font");
1686 if (TQDialog::Accepted != TDEFontDialog::getFont(font, false, m_active->widget()))
1693 if (TQDialog::Accepted != TDEFontDialog::getFontDiff(font, diffFlags, false, m_active->widget())
1697 for ( WidgetListIterator it(widgetsWithFontProperty); (widget = it.current()); ++it) {
1698 TQFont prevFont( widget->font() );
1699 if (diffFlags & TDEFontChooser::FontDiffFamily)
1700 prevFont.setFamily( font.family() );
1701 if (diffFlags & TDEFontChooser::FontDiffStyle) {
1702 prevFont.setBold( font.bold() );
1703 prevFont.setItalic( font.italic() );
1705 if (diffFlags & TDEFontChooser::FontDiffSize)
1706 prevFont.setPointSize( font.pointSize() );
1709 widget->setFont( prevFont );
1711 emit dirty(m_active, true);
1715#include "formmanager.moc"
A dialog to edit the contents of a PixmapCollection.
|