From f7c422c252b103e67c10b79a3a15ff19847c9604 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 16 Nov 2011 16:05:52 -0600 Subject: Finish rename from prior commit --- kexi/formeditor/kdevelop_plugin/Makefile.am | 21 - kexi/formeditor/kdevelop_plugin/kfd_kdev_part.cpp | 694 --------------------- kexi/formeditor/kdevelop_plugin/kfd_kdev_part.h | 142 ----- .../kformdesigner_kdev_part.desktop | 50 -- .../kdevelop_plugin/kformdesigner_part.rc | 129 ---- .../kdevelop_plugin/kformdesigner_part_shell.rc | 142 ----- kexi/formeditor/tdevelop_plugin/Makefile.am | 21 + kexi/formeditor/tdevelop_plugin/kfd_kdev_part.cpp | 694 +++++++++++++++++++++ kexi/formeditor/tdevelop_plugin/kfd_kdev_part.h | 142 +++++ .../kformdesigner_kdev_part.desktop | 50 ++ .../tdevelop_plugin/kformdesigner_part.rc | 129 ++++ .../tdevelop_plugin/kformdesigner_part_shell.rc | 142 +++++ 12 files changed, 1178 insertions(+), 1178 deletions(-) delete mode 100644 kexi/formeditor/kdevelop_plugin/Makefile.am delete mode 100644 kexi/formeditor/kdevelop_plugin/kfd_kdev_part.cpp delete mode 100644 kexi/formeditor/kdevelop_plugin/kfd_kdev_part.h delete mode 100644 kexi/formeditor/kdevelop_plugin/kformdesigner_kdev_part.desktop delete mode 100644 kexi/formeditor/kdevelop_plugin/kformdesigner_part.rc delete mode 100644 kexi/formeditor/kdevelop_plugin/kformdesigner_part_shell.rc create mode 100644 kexi/formeditor/tdevelop_plugin/Makefile.am create mode 100644 kexi/formeditor/tdevelop_plugin/kfd_kdev_part.cpp create mode 100644 kexi/formeditor/tdevelop_plugin/kfd_kdev_part.h create mode 100644 kexi/formeditor/tdevelop_plugin/kformdesigner_kdev_part.desktop create mode 100644 kexi/formeditor/tdevelop_plugin/kformdesigner_part.rc create mode 100644 kexi/formeditor/tdevelop_plugin/kformdesigner_part_shell.rc (limited to 'kexi') diff --git a/kexi/formeditor/kdevelop_plugin/Makefile.am b/kexi/formeditor/kdevelop_plugin/Makefile.am deleted file mode 100644 index 62507e9c..00000000 --- a/kexi/formeditor/kdevelop_plugin/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -include $(top_srcdir)/kexi/Makefile.global - -INCLUDES = -I$(top_srcdir)/kexi/formeditor -I$(top_srcdir)/kexi/core $(all_includes) -METASOURCES = AUTO - -# KFormDesigner KDevelop plugin -kde_module_LTLIBRARIES = libkformdesigner_kdev_part.la - -libkformdesigner_kdev_part_la_SOURCES = kfd_kdev_part.cpp -libkformdesigner_kdev_part_la_LDFLAGS = -module $(KDE_PLUGIN) $(VER_INFO) $(all_libraries) -libkformdesigner_kdev_part_la_LIBADD = $(top_builddir)/kexi/formeditor/libkformdesigner.la \ - -lkinterfacedesigner $(LIB_KFILE) - -# this is where the desktop file will go -partdesktopdir = $(kde_servicesdir) -partdesktop_DATA = kformdesigner_kdev_part.desktop - -# this is where the part's XML-GUI resource file goes -partrcdir = $(kde_datadir)/kformdesigner_kdev_part -partrc_DATA = kformdesigner_part.rc kformdesigner_part_shell.rc - diff --git a/kexi/formeditor/kdevelop_plugin/kfd_kdev_part.cpp b/kexi/formeditor/kdevelop_plugin/kfd_kdev_part.cpp deleted file mode 100644 index 0cfe0483..00000000 --- a/kexi/formeditor/kdevelop_plugin/kfd_kdev_part.cpp +++ /dev/null @@ -1,694 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Cedric Pasteur - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "form.h" -#include "formIO.h" -#include "objecttree.h" -#include "container.h" -#include "formmanager.h" -#include "objecttreeview.h" - -#include "kfd_kdev_part.h" - -#define ENABLE_ACTION(name, enable) \ - if(actionCollection()->action( name )) \ - actionCollection()->action( name )->setEnabled( enable ) - -KInstance *KFDFactory::m_instance = 0L; - -KFDFactory::KFDFactory() -: KParts::Factory(0, "libkformdesigner_kdev_part") -{} - -KFDFactory::~KFDFactory() -{ - if (m_instance) - { - delete m_instance->aboutData(); - delete m_instance; - } - - m_instance = 0; -} - -KParts::Part* -KFDFactory::createPartObject( TQWidget *parentWidget, const char *, TQObject *, const char *name, - const char *classname, const TQStringList &args) -{ - bool readOnly = (classname == "KParts::ReadOnlyPart"); - KFormDesignerKDevPart *part = new KFormDesignerKDevPart(parentWidget, name, readOnly, args); - return part; -} - -KInstance* -KFDFactory::instance() -{ - if (!m_instance) - m_instance = new KInstance(aboutData()); - return m_instance; -} - -KAboutData* -KFDFactory::aboutData() -{ - KAboutData *about = new KAboutData("kformdesigner_kdev_part", I18N_NOOP("Form Designer Part"), "0.3"); - return about; -} - -// copied from kfd_part.cpp -class KFDPart_FormManager : public KFormDesigner::FormManager -{ - public: - /*! Constructs FormManager object. - See WidgetLibrary's constructor documentation for information about - \a supportedFactoryGroups parameter. - Using \a options you can control manager's behaviour, see \ref Options. */ - KFDPart_FormManager(KFormDesignerPart *part, int options = 0, const char *name = 0) - : KFormDesigner::FormManager(part, options, name) - , m_part(part) - { - } - - virtual KAction* action( const char* name) - { - return m_part->actionCollection()->action( name ); - } - - virtual void enableAction( const char* name, bool enable ) { - if(m_part->actionCollection()->action( name )) - m_part->actionCollection()->action( name )->setEnabled( enable ); - } - - KFormDesignerPart *m_part; -}; - -////////////// - -KFormDesigner::WidgetLibrary* KFormDesignerKDevPart::static_formsLibrary = 0L; - -KFormDesignerKDevPart::KFormDesignerKDevPart(TQWidget *parent, const char *name, bool readOnly, const TQStringList &args) -: Designer(parent, name), m_count(0) -{ - setInstance(KFDFactory::instance()); - instance()->iconLoader()->addAppDir("kexi"); - instance()->iconLoader()->addAppDir("kformdesigner"); - - setReadWrite(!readOnly); - m_uniqueFormMode = true; - m_openingFile = false; - - if(!args.grep("multipleMode").isEmpty()) - setUniqueFormMode(false); - m_inShell = (!args.grep("shell").isEmpty()); - - TQHBox *container = new TQHBox(parent, "kfd_container_widget"); - container->setFocusPolicy(TQ_ClickFocus); - - m_workspace = new TQWorkspace(container, "kfd_workspace"); - m_workspace->show(); - TQStringList supportedFactoryGroups; -/* @todo add configuration for supported factory groups */ - static_formsLibrary = KFormDesigner::FormManager::createWidgetLibrary( - new KFDPart_FormManager(this, 0, "kfd_manager"), supportedFactoryGroups ); - - if(!readOnly) - { - TQDockArea *dockArea = new TQDockAreaQt::Vertical, TQDockArea::Reverse, container, "kfd_part_dockarea"); - - TQDockWindow *dockTree = new TQDockWindow(dockArea); - KFormDesigner::ObjectTreeView *view = new KFormDesigner::ObjectTreeView(dockTree); - dockTree->setWidget(view); - dockTree->setCaption(i18n("Objects")); - dockTree->setResizeEnabled(true); - dockTree->setFixedExtentWidth(256); - - TQDockWindow *dockEditor = new TQDockWindow(dockArea); - KoProperty::Editor *editor = new KoProperty::Editor(dockEditor); - dockEditor->setWidget(editor); - dockEditor->setCaption(i18n("Properties")); - dockEditor->setResizeEnabled(true); - - KFormDesigner::FormManager::self()->setEditor(editor); - KFormDesigner::FormManager::self()->setObjectTreeView(view); - - setupActions(); - setModified(false); - - // action stuff - connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(widgetSelected(KFormDesigner::Form*, bool)), TQT_SLOT(slotWidgetSelected(KFormDesigner::Form*, bool))); - connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(formWidgetSelected(KFormDesigner::Form*)), TQT_SLOT(slotFormWidgetSelected(KFormDesigner::Form*))); - connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(noFormSelected()), TQT_SLOT(slotNoFormSelected())); - connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(undoEnabled(bool, const TQString&)), TQT_SLOT(setUndoEnabled(bool, const TQString&))); - connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(redoEnabled(bool, const TQString&)), TQT_SLOT(setRedoEnabled(bool, const TQString&))); - - connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(dirty(KFormDesigner::Form*, bool)), this, TQT_SLOT(slotFormModified(KFormDesigner::Form*, bool))); - - connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(createFormSlot(KFormDesigner::Form*, const TQString&, const TQString&)), - this, TQT_SLOT(slotCreateFormSlot(KFormDesigner::Form*, const TQString&, const TQString &))); - } - - container->show(); - setWidget(container); - connect(m_workspace, TQT_SIGNAL(windowActivated(TQWidget*)), KFormDesigner::FormManager::self(), TQT_SLOT(windowChanged(TQWidget*))); - slotNoFormSelected(); -} - -KFormDesigner::WidgetLibrary* KFormDesignerKDevPart::formsLibrary() -{ - return static_formsLibrary; -} - -void -KFormDesignerKDevPart::setupActions() -{ - KStdAction::open(this, TQT_SLOT(open()), actionCollection()); - KStdAction::openNew(this, TQT_SLOT(createBlankForm()), actionCollection()); - KStdAction::save(this, TQT_SLOT(save()), actionCollection()); - KStdAction::saveAs(this, TQT_SLOT(saveAs()), actionCollection()); - KStdAction::cut(KFormDesigner::FormManager::self(), TQT_SLOT(cutWidget()), actionCollection()); - KStdAction::copy(KFormDesigner::FormManager::self(), TQT_SLOT(copyWidget()), actionCollection()); - KStdAction::paste(KFormDesigner::FormManager::self(), TQT_SLOT(pasteWidget()), actionCollection()); - KStdAction::undo(KFormDesigner::FormManager::self(), TQT_SLOT(undo()), actionCollection()); - KStdAction::redo(KFormDesigner::FormManager::self(), TQT_SLOT(redo()), actionCollection()); - KStdAction::selectAll(KFormDesigner::FormManager::self(), TQT_SLOT(selectAll()), actionCollection()); - new KAction(i18n("Clear Widget Contents"), "editclear", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(clearWidgetContent()), actionCollection(), "clear_contents"); - new KAction(i18n("Delete Widget"), "editdelete", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(deleteWidget()), actionCollection(), "edit_delete"); - new KAction(i18n("Preview Form"), "filequickprint", "Ctrl+T", this, TQT_SLOT(slotPreviewForm()), actionCollection(), "preview_form"); - new KAction(i18n("Edit Tab Order"), "tab_order", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(editTabOrder()), actionCollection(), "taborder"); - new KAction(i18n("Edit Pixmap Collection"), "icons", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(editFormPixmapCollection()), actionCollection(), "pixmap_collection"); - new KAction(i18n("Edit Form Connections"), "connections", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(editConnections()), actionCollection(), "form_connections"); - - new KAction(i18n("Lay Out Widgets &Horizontally"), TQString(), KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(layoutHBox()), actionCollection(), "layout_hbox"); - new KAction(i18n("Lay Out Widgets &Vertically"), TQString(), KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(layoutVBox()), actionCollection(), "layout_vbox"); - new KAction(i18n("Lay Out Widgets in &Grid"), TQString(), KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(layoutGrid()), actionCollection(), "layout_grid"); - new KAction(i18n("&Break Layout"), TQString(), KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(breakLayout()), actionCollection(), "break_layout"); - - new KAction(i18n("Bring Widget to Front"), "raise", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(bringWidgetToFront()), actionCollection(), "format_raise"); - new KAction(i18n("Send Widget to Back"), "lower", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(sendWidgetToBack()), actionCollection(), "format_lower"); - - KActionMenu *alignMenu = new KActionMenu(i18n("Align Widgets' Positions"), "aopos2grid", actionCollection(), "align_menu"); - alignMenu->insert( new KAction(i18n("To Left"), "aoleft", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToLeft()), actionCollection(), "align_to_left") ); - alignMenu->insert( new KAction(i18n("To Right"), "aoright", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToRight()), actionCollection(), "align_to_right") ); - alignMenu->insert( new KAction(i18n("To Top"), "aotop", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToTop()), actionCollection(), "align_to_top") ); - alignMenu->insert( new KAction(i18n("To Bottom"), "aobottom", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToBottom()), actionCollection(), "align_to_bottom") ); - alignMenu->insert( new KAction(i18n("To Grid"), "aopos2grid", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToGrid()), actionCollection(), "align_to_grid") ); - - KActionMenu *sizeMenu = new KActionMenu(i18n("Adjust Widgets' Sizes"), "aogrid", actionCollection(), "adjust_size_menu"); - sizeMenu->insert( new KAction(i18n("To Fit"), "aofit", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustWidgetSize()), actionCollection(), "adjust_to_fit") ); - sizeMenu->insert( new KAction(i18n("To Grid"), "aogrid", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustSizeToGrid()), actionCollection(), "adjust_size_grid") ); - sizeMenu->insert( new KAction(i18n("To Shortest"), "aoshortest", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustHeightToSmall()), actionCollection(), "adjust_height_small") ); - sizeMenu->insert( new KAction(i18n("To Tallest"), "aotallest", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustHeightToBig()), actionCollection(), "adjust_height_big") ); - sizeMenu->insert( new KAction(i18n("To Narrowest"), "aonarrowest", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustWidthToSmall()), actionCollection(), "adjust_width_small") ); - sizeMenu->insert( new KAction(i18n("To Widest"), "aowidest", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustWidthToBig()), actionCollection(), "adjust_width_big") ); - - if(m_inShell) - setXMLFile("kformdesigner_part_shell.rc"); - else - setXMLFile("kformdesigner_part.rc"); - KFormDesigner::FormManager::self()->createActions(formsLibrary(), actionCollection(), this); -} - -void -KFormDesignerKDevPart::createBlankForm() -{ - if(KFormDesigner::FormManager::self()->activeForm() && m_uniqueFormMode) - { - m_openingFile = true; - closeURL(); - m_openingFile = false; - } - - if(m_uniqueFormMode && KFormDesigner::FormManager::self()->activeForm() && !KFormDesigner::FormManager::self()->activeForm()->isModified() && KFormDesigner::FormManager::self()->activeForm()->filename().isNull()) - return; // active form is already a blank one - - TQString n = i18n("Form") + TQString::number(++m_count); - Form *form = new Form(formsLibrary(), n.latin1()); - FormWidgetBase *w = new FormWidgetBase(this, m_workspace, n.latin1()); - - w->setCaption(n); - w->setIcon(SmallIcon("form")); - w->resize(350, 300); - w->show(); - w->setFocus(); - - form->createToplevel(w, w); - KFormDesigner::FormManager::self()->importForm(form); -} - -void -KFormDesignerKDevPart::open() -{ - m_openingFile = true; - KURL url = KFileDialog::getOpenURL("::kformdesigner", i18n("*.ui|TQt Designer UI Files"), m_workspace->tqtopLevelWidget()); - if(!url.isEmpty()) - ReadWritePart::openURL(url); - m_openingFile = false; -} - -bool -KFormDesignerKDevPart::openFile() -{ - Form *form = new Form(formsLibrary()); - FormWidgetBase *w = new FormWidgetBase(this, m_workspace); - form->createToplevel(w, w); - - if(!KFormDesigner::FormIO::loadForm(form, w, m_file)) - { - delete form; - delete w; - return false; - } - - w->show(); - KFormDesigner::FormManager::self()->importForm(form, !isReadWrite()); - return true; -} - -bool -KFormDesignerKDevPart::saveFile() -{ - KFormDesigner::FormIO::saveForm(KFormDesigner::FormManager::self()->activeForm(), m_file); - return true; -} - -void -KFormDesignerKDevPart::saveAs() -{ - KURL url = KFileDialog::getSaveURL("::kformdesigner", i18n("*.ui|TQt Designer UI Files"), m_workspace); - if(url.isEmpty()) - return; - else - ReadWritePart::saveAs(url); -} - -bool -KFormDesignerKDevPart::closeForm(Form *form) -{ - int res = KMessageBox::warningYesNoCancel( m_workspace->tqtopLevelWidget(), - i18n( "The form \"%1\" has been modified.\n" - "Do you want to save your changes or discard them?" ).tqarg( form->objectTree()->name() ), - i18n( "Close Form" ), KStdGuiItem::save(), KStdGuiItem::discard() ); - - if(res == KMessageBox::Yes) - save(); - - return (res != KMessageBox::Cancel); -} - -bool -KFormDesignerKDevPart::closeForms() -{ - TQWidgetList list = m_workspace->windowList(TQWorkspace::CreationOrder); - for(TQWidget *w = list.first(); w; w = list.next()) - if(w->close() == false) - return false; - - return true; -} - -bool -KFormDesignerKDevPart::closeURL() -{ - if(!KFormDesigner::FormManager::self()->activeForm()) - return true; - - if(m_uniqueFormMode || !m_openingFile) - return closeForms(); - - return true; -} - -void -KFormDesignerKDevPart::slotFormModified(Form *, bool isDirty) -{ - setModified(isDirty); -} - -void -KFormDesignerKDevPart::slotPreviewForm() -{ - if(!KFormDesigner::FormManager::self()->activeForm()) - return; - - FormWidgetBase *w = new FormWidgetBase(this, m_workspace); - KFormDesigner::FormManager::self()->previewForm(KFormDesigner::FormManager::self()->activeForm(), w); -} - -void -KFormDesignerKDevPart::slotWidgetSelected(Form *form, bool multiple) -{ - enableFormActions(); - // Enable edit actions - ENABLE_ACTION("edit_copy", true); - ENABLE_ACTION("edit_cut", true); - ENABLE_ACTION("edit_delete", true); - ENABLE_ACTION("clear_contents", true); - - // 'Align Widgets' menu - ENABLE_ACTION("align_menu", multiple); - ENABLE_ACTION("align_to_left", multiple); - ENABLE_ACTION("align_to_right", multiple); - ENABLE_ACTION("align_to_top", multiple); - ENABLE_ACTION("align_to_bottom", multiple); - - ENABLE_ACTION("adjust_size_menu", true); - ENABLE_ACTION("adjust_width_small", multiple); - ENABLE_ACTION("adjust_width_big", multiple); - ENABLE_ACTION("adjust_height_small", multiple); - ENABLE_ACTION("adjust_height_big", multiple); - - ENABLE_ACTION("format_raise", true); - ENABLE_ACTION("format_lower", true); - - // If the widgets selected is a container, we enable tqlayout actions - if(!multiple) - { - KFormDesigner::ObjectTreeItem *item = form->objectTree()->lookup( form->selectedWidgets()->first()->name() ); - if(item && item->container()) - multiple = true; - } - // Layout actions - ENABLE_ACTION("layout_hbox", multiple); - ENABLE_ACTION("layout_vbox", multiple); - ENABLE_ACTION("layout_grid", multiple); - - KFormDesigner::Container *container = KFormDesigner::FormManager::self()->activeForm()->activeContainer(); - ENABLE_ACTION("break_layout", (container->layoutType() != KFormDesigner::Container::NoLayout)); -} - -void -KFormDesignerKDevPart::slotFormWidgetSelected(Form *form) -{ - disableWidgetActions(); - enableFormActions(); - - // Layout actions - ENABLE_ACTION("layout_hbox", true); - ENABLE_ACTION("layout_vbox", true); - ENABLE_ACTION("layout_grid", true); - ENABLE_ACTION("break_layout", (form->toplevelContainer()->layoutType() != KFormDesigner::Container::NoLayout)); -} - -void -KFormDesignerKDevPart::slotNoFormSelected() -{ - disableWidgetActions(); - - // Disable paste action - ENABLE_ACTION("edit_paste", false); - - ENABLE_ACTION("edit_undo", false); - ENABLE_ACTION("edit_redo", false); - - // Disable 'Tools' actions - ENABLE_ACTION("pixmap_collection", false); - ENABLE_ACTION("form_connections", false); - ENABLE_ACTION("taborder", false); - ENABLE_ACTION("change_style", false); - - // Disable items in 'File' - ENABLE_ACTION("file_save", false); - ENABLE_ACTION("file_save_as", false); - ENABLE_ACTION("preview_form", false); -} - -void -KFormDesignerKDevPart::enableFormActions() -{ - // Enable 'Tools' actions - ENABLE_ACTION("pixmap_collection", true); - ENABLE_ACTION("form_connections", true); - ENABLE_ACTION("taborder", true); - ENABLE_ACTION("change_style", true); - - // Enable items in 'File' - ENABLE_ACTION("file_save", true); - ENABLE_ACTION("file_save_as", true); - ENABLE_ACTION("preview_form", true); - - ENABLE_ACTION("edit_paste", KFormDesigner::FormManager::self()->isPasteEnabled()); - ENABLE_ACTION("edit_select_all", true); -} - -void -KFormDesignerKDevPart::disableWidgetActions() -{ - // Disable edit actions - ENABLE_ACTION("edit_copy", false); - ENABLE_ACTION("edit_cut", false); - ENABLE_ACTION("edit_delete", false); - ENABLE_ACTION("clear_contents", false); - - // Disable format functions - ENABLE_ACTION("align_menu", false); - ENABLE_ACTION("align_to_left", false); - ENABLE_ACTION("align_to_right", false); - ENABLE_ACTION("align_to_top", false); - ENABLE_ACTION("align_to_bottom", false); - ENABLE_ACTION("adjust_size_menu", false); - ENABLE_ACTION("format_raise", false); - ENABLE_ACTION("format_lower", false); - - ENABLE_ACTION("layout_hbox", false); - ENABLE_ACTION("layout_vbox", false); - ENABLE_ACTION("layout_grid", false); - ENABLE_ACTION("break_layout", false); -} - -void -KFormDesignerKDevPart::setUndoEnabled(bool enabled, const TQString &text) -{ - KAction *undoAction = actionCollection()->action("edit_undo"); - if(undoAction) - { - undoAction->setEnabled(enabled); - if(!text.isNull()) - undoAction->setText(text); - } -} - -void -KFormDesignerKDevPart::setRedoEnabled(bool enabled, const TQString &text) -{ - KAction *redoAction = actionCollection()->action("edit_redo"); - if(redoAction) - { - redoAction->setEnabled(enabled); - if(!text.isNull()) - redoAction->setText(text); - } -} - -void -KFormDesignerKDevPart::slotCreateFormSlot(Form *form, const TQString &widget, const TQString &signal) -{ - Function f; - f.returnType = "void"; - f.function = widget + "_" + signal; - f.specifier = "non virtual"; - f.access = "public"; - f.type = ftTQtSlot; - emit addedFunction(designerType(), form->objectTree()->name(), f); -} - -KFormDesignerKDevPart::~KFormDesignerKDevPart() -{ -} - - -////// FormWidgetBase : helper widget to draw rects on top of widgets - -//tqrepaint all tqchildren widgets -static void repaintAll(TQWidget *w) -{ - TQObjectList *list = w->queryList(TQWIDGET_OBJECT_NAME_STRING); - TQObjectListIt it(*list); - for (TQObject *obj; (obj=it.current()); ++it ) { - static_cast(obj)->tqrepaint(); - } - delete list; -} - -void -FormWidgetBase::drawRects(const TQValueList &list, int type) -{ - TQPainter p; - p.begin(this, true); - bool unclipped = testWFlags( WPaintUnclipped ); - setWFlags( WPaintUnclipped ); - - if (prev_rect.isValid()) { - //redraw prev. selection's rectangle - p.drawPixmap( TQPoint(prev_rect.x()-2, prev_rect.y()-2), buffer, TQRect(prev_rect.x()-2, prev_rect.y()-2, prev_rect.width()+4, prev_rect.height()+4)); - } - p.setBrush(TQBrush::NoBrush); - if(type == 1) // selection rect - p.setPen(TQPen(white, 1, TQt::DotLine)); - else if(type == 2) // insert rect - p.setPen(TQPen(white, 2)); - p.setRasterOp(XorROP); - - prev_rect = TQRect(); - TQValueList::ConstIterator endIt = list.constEnd(); - for(TQValueList::ConstIterator it = list.constBegin(); it != endIt; ++it) { - p.drawRect(*it); - prev_rect = prev_rect.unite(*it); - } - - if (!unclipped) - clearWFlags( WPaintUnclipped ); - p.end(); -} - -void -FormWidgetBase::drawRect(const TQRect& r, int type) -{ - TQValueList l; - l.append(r); - drawRects(l, type); -} - -void -FormWidgetBase::initRect() -{ - repaintAll(this); - buffer.resize( width(), height() ); - buffer = TQPixmap::grabWindow( winId() ); - prev_rect = TQRect(); -} - -void -FormWidgetBase::clearRect() -{ - TQPainter p; - p.begin(this, true); - bool unclipped = testWFlags( WPaintUnclipped ); - setWFlags( WPaintUnclipped ); - - //redraw entire form surface - p.drawPixmap( TQPoint(0,0), buffer, TQRect(0,0,buffer.width(), buffer.height()) ); - - if (!unclipped) - clearWFlags( WPaintUnclipped ); - p.end(); - - repaintAll(this); -} - -void -FormWidgetBase::highlightWidgets(TQWidget *from, TQWidget *to)//, const TQPoint &point) -{ - TQPoint fromPoint, toPoint; - if(from && from->parentWidget() && (from != this)) - fromPoint = from->parentWidget()->mapTo(this, from->pos()); - if(to && to->parentWidget() && (to != this)) - toPoint = to->parentWidget()->mapTo(this, to->pos()); - - TQPainter p; - p.begin(this, true); - bool unclipped = testWFlags( WPaintUnclipped ); - setWFlags( WPaintUnclipped ); - - if (prev_rect.isValid()) { - //redraw prev. selection's rectangle - p.drawPixmap( TQPoint(prev_rect.x(), prev_rect.y()), buffer, TQRect(prev_rect.x(), prev_rect.y(), prev_rect.width(), prev_rect.height())); - } - - p.setPen( TQPen(TQt::red, 2) ); - - if(to) - { - TQPixmap pix1 = TQPixmap::grabWidget(from); - TQPixmap pix2 = TQPixmap::grabWidget(to); - - if((from != this) && (to != this)) - p.drawLine( from->parentWidget()->mapTo(this, from->tqgeometry().center()), to->parentWidget()->mapTo(this, to->tqgeometry().center()) ); - - p.drawPixmap(fromPoint.x(), fromPoint.y(), pix1); - p.drawPixmap(toPoint.x(), toPoint.y(), pix2); - - if(to == this) - p.drawRoundRect(2, 2, width()-4, height()-4, 4, 4); - else - p.drawRoundRect(toPoint.x(), toPoint.y(), to->width(), to->height(), 5, 5); - } - - if(from == this) - p.drawRoundRect(2, 2, width()-4, height()-4, 4, 4); - else - p.drawRoundRect(fromPoint.x(), fromPoint.y(), from->width(), from->height(), 5, 5); - - if((to == this) || (from == this)) - prev_rect = TQRect(0, 0, buffer.width(), buffer.height()); - else if(to) - { - prev_rect.setX( (fromPoint.x() < toPoint.x()) ? (fromPoint.x() - 5) : (toPoint.x() - 5) ); - prev_rect.setY( (fromPoint.y() < toPoint.y()) ? (fromPoint.y() - 5) : (toPoint.y() - 5) ); - prev_rect.setRight( (fromPoint.x() < toPoint.x()) ? (toPoint.x() + to->width() + 10) : (fromPoint.x() + from->width() + 10) ); - prev_rect.setBottom( (fromPoint.y() < toPoint.y()) ? (toPoint.y() + to->height() + 10) : (fromPoint.y() + from->height() + 10) ) ; - } - else - prev_rect = TQRect(fromPoint.x()- 5, fromPoint.y() -5, from->width() + 10, from->height() + 10); - - if (!unclipped) - clearWFlags( WPaintUnclipped ); - p.end(); -} - -void -FormWidgetBase::closeEvent(TQCloseEvent *ev) -{ - Form *form = KFormDesigner::FormManager::self()->formForWidget(this); - if(!form || !form->isModified() || !form->objectTree()) // == preview form - ev->accept(); - else - { - bool close = m_part->closeForm(form); - if(close) - ev->accept(); - else - ev->ignore(); - } -} - -K_EXPORT_COMPONENT_FACTORY(libkformdesigner_kdev_part, KFDFactory) - -#include "kfd_kdev_part.moc" - diff --git a/kexi/formeditor/kdevelop_plugin/kfd_kdev_part.h b/kexi/formeditor/kdevelop_plugin/kfd_kdev_part.h deleted file mode 100644 index b6929e5c..00000000 --- a/kexi/formeditor/kdevelop_plugin/kfd_kdev_part.h +++ /dev/null @@ -1,142 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Cedric Pasteur - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#ifndef KFORMDESIGNER_KDEVELOP_PART_H -#define KFORMDESIGNER_KDEVELOP_PART_H - -#include -#include - -#include -#include - -#include "form.h" - -class KAboutData; -class KInstance; -class TQWorkspace; -class TQCloseEvent; - -using KFormDesigner::Form; -using namespace KInterfaceDesigner; - -class KFORMEDITOR_EXPORT KFDFactory : public KParts::Factory -{ - Q_OBJECT - TQ_OBJECT - - public: - KFDFactory(); - virtual ~KFDFactory(); - - virtual KParts::Part* createPartObject(TQWidget *parentWidget=0, const char *widgetName=0, TQObject *parent=0, const char *name=0, - const char *classname="KParts::Part", const TQStringList &args=TQStringList()); - - static KInstance *instance(); - static KAboutData *aboutData(); - - private: - static KInstance *m_instance; -}; - -class KFORMEDITOR_EXPORT KFormDesignerKDevPart : public Designer -{ - Q_OBJECT - TQ_OBJECT - - public: - KFormDesignerKDevPart(TQWidget *parent, const char *name, bool readOnly=true, const TQStringList &args=TQStringList()); - virtual ~KFormDesignerKDevPart(); - - virtual DesignerType designerType() { return TQtDesigner; } - virtual void openProject(const TQString &) {} - -// KFormDesigner::FormManager* manager() { return m_manager; } - void setUniqueFormMode(bool enable) { m_uniqueFormMode = enable; } - - bool closeForm(Form *form); - bool closeForms(); - - virtual bool closeURL(); - - static KFormDesigner::WidgetLibrary* formsLibrary(); - - public slots: - /*! Creates a new blank Form. The new Form is shown and become the active Form. */ - void createBlankForm(); - /*! Loads a Form from a UI file. A "Open File" dialog is shown to select the file. The loaded Form is shown and becomes - the active Form. */ - void open(); - void slotPreviewForm(); - void saveAs(); - void slotCreateFormSlot(KFormDesigner::Form *form, const TQString &widget, const TQString &signal); - - protected slots: - void slotWidgetSelected(KFormDesigner::Form *form, bool multiple); - void slotFormWidgetSelected(KFormDesigner::Form *form); - void slotNoFormSelected(); - void slotFormModified(KFormDesigner::Form *form, bool isDirty); - void setUndoEnabled(bool enabled, const TQString &text); - void setRedoEnabled(bool enabled, const TQString &text); - - protected: - virtual bool openFile(); - virtual bool saveFile(); - void disableWidgetActions(); - void enableFormActions(); - void setupActions(); - - private: - static KFormDesigner::WidgetLibrary* static_formsLibrary; -// KFormDesigner::FormManager *m_manager; - TQWorkspace *m_workspace; - int m_count; - bool m_uniqueFormMode; - bool m_openingFile; - bool m_inShell; -}; - -//! Helper: this widget is used to create form's surface -class KFORMEDITOR_EXPORT FormWidgetBase : public TQWidget, public KFormDesigner::FormWidget -{ - Q_OBJECT - TQ_OBJECT - - public: - FormWidgetBase(KFormDesignerKDevPart *part, TQWidget *parent = 0, const char *name = 0, int WFlags = WDestructiveClose) - : TQWidget(parent, name, WFlags), m_part(part) {} - ~FormWidgetBase() {;} - - void drawRect(const TQRect& r, int type); - void drawRects(const TQValueList &list, int type); - void initRect(); - void clearRect(); - void highlightWidgets(TQWidget *from, TQWidget *to);//, const TQPoint &p); - - protected: - void closeEvent(TQCloseEvent *ev); - - private: - TQPixmap buffer; //!< stores grabbed entire form's area for redraw - TQRect prev_rect; //!< previously selected rectangle - KFormDesignerKDevPart *m_part; -}; - -#endif - diff --git a/kexi/formeditor/kdevelop_plugin/kformdesigner_kdev_part.desktop b/kexi/formeditor/kdevelop_plugin/kformdesigner_kdev_part.desktop deleted file mode 100644 index c94e628f..00000000 --- a/kexi/formeditor/kdevelop_plugin/kformdesigner_kdev_part.desktop +++ /dev/null @@ -1,50 +0,0 @@ -[Desktop Entry] -Name=Form Designer KDevelop Plugin -Name[bg]=Приставка на KDevelop за проектиране на форми -Name[ca]=Endollat de disseny de formulari de KDevelop -Name[cy]=Ategyn KDevelop: Dylunydd Ffurflenni -Name[da]=Form Designer KDEvelop-plugin -Name[de]=KDevelop-Modul zum Formularentwurf -Name[el]=Πρόσθετο σχεδίασης φόρμας του KDevelop -Name[eo]=Formulardesegnila kromaĵo por KDevelop -Name[es]=Complemento de diseñador de formularios de KDevelop -Name[et]=Vormikujundaja KDevelopi plugin -Name[eu]=Formularioak diseinatzeko KDevelop-en plugina -Name[fa]=وصلۀ KDevelop طراح برگه -Name[fi]=KDevelopin lomakkeen suunnittelija -liitännäinen -Name[fr]=Module externe KDevelop de composition d'interfaces graphiques -Name[fy]=KDevelop-plugin FormDesigner -Name[gl]=Plugin de Deseño de Formularios para Kdevelop -Name[he]=תוסף מעצב טפסים ל־KDevelop -Name[hr]=KDevelop dodatak dizajnera obrazaca -Name[hu]=Űrlaptervező modul a KDevelophoz -Name[is]=Form hönnunar KDevelop íforrit -Name[it]=Plugin di KDevelop per il progetto dei moduli -Name[ja]=フォームデザイナー Kdevelop プラグイン -Name[km]=កម្មវិធី​ជំនួយ​កម្មវិធី​រចនា​សំណុំបែបបទ​សម្រាប់ KDevelop -Name[lv]=KDevelop formu veidošanas spraudnis -Name[ms]=Plugin KDevelop Pereka Bentuk Borang -Name[nb]=KDevelop-tillegg for skjemautforming -Name[nds]=KDevelop-Moduul för't Opstellen vun Kiekwarken -Name[ne]=फारम डिजाइनकर्ता केडीई विकास प्लगइन -Name[nl]=KDevelop-plugin FormDesigner -Name[nn]=KDevelop-tillegg for skjemautforming -Name[pl]=Wtyczka projektanta formularzy dla KDevelop -Name[pt]='Plugin' para o KDevelop de Desenho de Formulários -Name[pt_BR]=Plugin do Desenhista de Formulário do KDevelop -Name[ru]=Модуль форм KDevelop -Name[sk]=KDevelop modul na vytváranie formulárov (Form Designer) -Name[sl]=Vstavek za oblikovanje obrazcev za KDevelop -Name[sr]=Прикључак дизајнера форми за KDevelop -Name[sr@Latn]=Priključak dizajnera formi za KDevelop -Name[sv]=KDevelop insticksprogram för formulärkonstruktion -Name[ta]=படிவ வடிவமைப்பாளர் கேடெவெலப் சொருகுப்பொருள் -Name[tr]=FormTasarımcısı KDevelop Eklentisi -Name[uk]=Втулок дизайнера форм KDevelop -Name[zh_CN]=表单设计器 KDevelop 插件 -Name[zh_TW]=表單設計師 KDevelop 外掛程式 -MimeType=application/x-designer; -ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart -X-KDE-Library=libkformdesigner_kdev_part -Type=Service -InitialPreference=0 diff --git a/kexi/formeditor/kdevelop_plugin/kformdesigner_part.rc b/kexi/formeditor/kdevelop_plugin/kformdesigner_part.rc deleted file mode 100644 index 3cadda53..00000000 --- a/kexi/formeditor/kdevelop_plugin/kformdesigner_part.rc +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - &Widgets - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &Format - - - - - - - - - - - - - - - -Main Toolbar - - - - - - - - - - - - - Containers - - - - - - - - Widgets - - - - - - - - - - - - - - - - - - - - - - - - -Tools Toolbar - - - - -Format Toolbar - - - - - \ No newline at end of file diff --git a/kexi/formeditor/kdevelop_plugin/kformdesigner_part_shell.rc b/kexi/formeditor/kdevelop_plugin/kformdesigner_part_shell.rc deleted file mode 100644 index 8b592752..00000000 --- a/kexi/formeditor/kdevelop_plugin/kformdesigner_part_shell.rc +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &Widgets - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &Format - - - - - - - - - - - - - - - -Main Toolbar - - - - - - - - - - - - - - - - Containers - - - - - - - - Widgets - - - - - - - - - - - - - - - - - - - - - - - - -Tools Toolbar - - - - -Format Toolbar - - - - - \ No newline at end of file diff --git a/kexi/formeditor/tdevelop_plugin/Makefile.am b/kexi/formeditor/tdevelop_plugin/Makefile.am new file mode 100644 index 00000000..62507e9c --- /dev/null +++ b/kexi/formeditor/tdevelop_plugin/Makefile.am @@ -0,0 +1,21 @@ +include $(top_srcdir)/kexi/Makefile.global + +INCLUDES = -I$(top_srcdir)/kexi/formeditor -I$(top_srcdir)/kexi/core $(all_includes) +METASOURCES = AUTO + +# KFormDesigner KDevelop plugin +kde_module_LTLIBRARIES = libkformdesigner_kdev_part.la + +libkformdesigner_kdev_part_la_SOURCES = kfd_kdev_part.cpp +libkformdesigner_kdev_part_la_LDFLAGS = -module $(KDE_PLUGIN) $(VER_INFO) $(all_libraries) +libkformdesigner_kdev_part_la_LIBADD = $(top_builddir)/kexi/formeditor/libkformdesigner.la \ + -lkinterfacedesigner $(LIB_KFILE) + +# this is where the desktop file will go +partdesktopdir = $(kde_servicesdir) +partdesktop_DATA = kformdesigner_kdev_part.desktop + +# this is where the part's XML-GUI resource file goes +partrcdir = $(kde_datadir)/kformdesigner_kdev_part +partrc_DATA = kformdesigner_part.rc kformdesigner_part_shell.rc + diff --git a/kexi/formeditor/tdevelop_plugin/kfd_kdev_part.cpp b/kexi/formeditor/tdevelop_plugin/kfd_kdev_part.cpp new file mode 100644 index 00000000..0cfe0483 --- /dev/null +++ b/kexi/formeditor/tdevelop_plugin/kfd_kdev_part.cpp @@ -0,0 +1,694 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Cedric Pasteur + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "form.h" +#include "formIO.h" +#include "objecttree.h" +#include "container.h" +#include "formmanager.h" +#include "objecttreeview.h" + +#include "kfd_kdev_part.h" + +#define ENABLE_ACTION(name, enable) \ + if(actionCollection()->action( name )) \ + actionCollection()->action( name )->setEnabled( enable ) + +KInstance *KFDFactory::m_instance = 0L; + +KFDFactory::KFDFactory() +: KParts::Factory(0, "libkformdesigner_kdev_part") +{} + +KFDFactory::~KFDFactory() +{ + if (m_instance) + { + delete m_instance->aboutData(); + delete m_instance; + } + + m_instance = 0; +} + +KParts::Part* +KFDFactory::createPartObject( TQWidget *parentWidget, const char *, TQObject *, const char *name, + const char *classname, const TQStringList &args) +{ + bool readOnly = (classname == "KParts::ReadOnlyPart"); + KFormDesignerKDevPart *part = new KFormDesignerKDevPart(parentWidget, name, readOnly, args); + return part; +} + +KInstance* +KFDFactory::instance() +{ + if (!m_instance) + m_instance = new KInstance(aboutData()); + return m_instance; +} + +KAboutData* +KFDFactory::aboutData() +{ + KAboutData *about = new KAboutData("kformdesigner_kdev_part", I18N_NOOP("Form Designer Part"), "0.3"); + return about; +} + +// copied from kfd_part.cpp +class KFDPart_FormManager : public KFormDesigner::FormManager +{ + public: + /*! Constructs FormManager object. + See WidgetLibrary's constructor documentation for information about + \a supportedFactoryGroups parameter. + Using \a options you can control manager's behaviour, see \ref Options. */ + KFDPart_FormManager(KFormDesignerPart *part, int options = 0, const char *name = 0) + : KFormDesigner::FormManager(part, options, name) + , m_part(part) + { + } + + virtual KAction* action( const char* name) + { + return m_part->actionCollection()->action( name ); + } + + virtual void enableAction( const char* name, bool enable ) { + if(m_part->actionCollection()->action( name )) + m_part->actionCollection()->action( name )->setEnabled( enable ); + } + + KFormDesignerPart *m_part; +}; + +////////////// + +KFormDesigner::WidgetLibrary* KFormDesignerKDevPart::static_formsLibrary = 0L; + +KFormDesignerKDevPart::KFormDesignerKDevPart(TQWidget *parent, const char *name, bool readOnly, const TQStringList &args) +: Designer(parent, name), m_count(0) +{ + setInstance(KFDFactory::instance()); + instance()->iconLoader()->addAppDir("kexi"); + instance()->iconLoader()->addAppDir("kformdesigner"); + + setReadWrite(!readOnly); + m_uniqueFormMode = true; + m_openingFile = false; + + if(!args.grep("multipleMode").isEmpty()) + setUniqueFormMode(false); + m_inShell = (!args.grep("shell").isEmpty()); + + TQHBox *container = new TQHBox(parent, "kfd_container_widget"); + container->setFocusPolicy(TQ_ClickFocus); + + m_workspace = new TQWorkspace(container, "kfd_workspace"); + m_workspace->show(); + TQStringList supportedFactoryGroups; +/* @todo add configuration for supported factory groups */ + static_formsLibrary = KFormDesigner::FormManager::createWidgetLibrary( + new KFDPart_FormManager(this, 0, "kfd_manager"), supportedFactoryGroups ); + + if(!readOnly) + { + TQDockArea *dockArea = new TQDockAreaQt::Vertical, TQDockArea::Reverse, container, "kfd_part_dockarea"); + + TQDockWindow *dockTree = new TQDockWindow(dockArea); + KFormDesigner::ObjectTreeView *view = new KFormDesigner::ObjectTreeView(dockTree); + dockTree->setWidget(view); + dockTree->setCaption(i18n("Objects")); + dockTree->setResizeEnabled(true); + dockTree->setFixedExtentWidth(256); + + TQDockWindow *dockEditor = new TQDockWindow(dockArea); + KoProperty::Editor *editor = new KoProperty::Editor(dockEditor); + dockEditor->setWidget(editor); + dockEditor->setCaption(i18n("Properties")); + dockEditor->setResizeEnabled(true); + + KFormDesigner::FormManager::self()->setEditor(editor); + KFormDesigner::FormManager::self()->setObjectTreeView(view); + + setupActions(); + setModified(false); + + // action stuff + connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(widgetSelected(KFormDesigner::Form*, bool)), TQT_SLOT(slotWidgetSelected(KFormDesigner::Form*, bool))); + connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(formWidgetSelected(KFormDesigner::Form*)), TQT_SLOT(slotFormWidgetSelected(KFormDesigner::Form*))); + connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(noFormSelected()), TQT_SLOT(slotNoFormSelected())); + connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(undoEnabled(bool, const TQString&)), TQT_SLOT(setUndoEnabled(bool, const TQString&))); + connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(redoEnabled(bool, const TQString&)), TQT_SLOT(setRedoEnabled(bool, const TQString&))); + + connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(dirty(KFormDesigner::Form*, bool)), this, TQT_SLOT(slotFormModified(KFormDesigner::Form*, bool))); + + connect(KFormDesigner::FormManager::self(), TQT_SIGNAL(createFormSlot(KFormDesigner::Form*, const TQString&, const TQString&)), + this, TQT_SLOT(slotCreateFormSlot(KFormDesigner::Form*, const TQString&, const TQString &))); + } + + container->show(); + setWidget(container); + connect(m_workspace, TQT_SIGNAL(windowActivated(TQWidget*)), KFormDesigner::FormManager::self(), TQT_SLOT(windowChanged(TQWidget*))); + slotNoFormSelected(); +} + +KFormDesigner::WidgetLibrary* KFormDesignerKDevPart::formsLibrary() +{ + return static_formsLibrary; +} + +void +KFormDesignerKDevPart::setupActions() +{ + KStdAction::open(this, TQT_SLOT(open()), actionCollection()); + KStdAction::openNew(this, TQT_SLOT(createBlankForm()), actionCollection()); + KStdAction::save(this, TQT_SLOT(save()), actionCollection()); + KStdAction::saveAs(this, TQT_SLOT(saveAs()), actionCollection()); + KStdAction::cut(KFormDesigner::FormManager::self(), TQT_SLOT(cutWidget()), actionCollection()); + KStdAction::copy(KFormDesigner::FormManager::self(), TQT_SLOT(copyWidget()), actionCollection()); + KStdAction::paste(KFormDesigner::FormManager::self(), TQT_SLOT(pasteWidget()), actionCollection()); + KStdAction::undo(KFormDesigner::FormManager::self(), TQT_SLOT(undo()), actionCollection()); + KStdAction::redo(KFormDesigner::FormManager::self(), TQT_SLOT(redo()), actionCollection()); + KStdAction::selectAll(KFormDesigner::FormManager::self(), TQT_SLOT(selectAll()), actionCollection()); + new KAction(i18n("Clear Widget Contents"), "editclear", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(clearWidgetContent()), actionCollection(), "clear_contents"); + new KAction(i18n("Delete Widget"), "editdelete", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(deleteWidget()), actionCollection(), "edit_delete"); + new KAction(i18n("Preview Form"), "filequickprint", "Ctrl+T", this, TQT_SLOT(slotPreviewForm()), actionCollection(), "preview_form"); + new KAction(i18n("Edit Tab Order"), "tab_order", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(editTabOrder()), actionCollection(), "taborder"); + new KAction(i18n("Edit Pixmap Collection"), "icons", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(editFormPixmapCollection()), actionCollection(), "pixmap_collection"); + new KAction(i18n("Edit Form Connections"), "connections", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(editConnections()), actionCollection(), "form_connections"); + + new KAction(i18n("Lay Out Widgets &Horizontally"), TQString(), KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(layoutHBox()), actionCollection(), "layout_hbox"); + new KAction(i18n("Lay Out Widgets &Vertically"), TQString(), KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(layoutVBox()), actionCollection(), "layout_vbox"); + new KAction(i18n("Lay Out Widgets in &Grid"), TQString(), KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(layoutGrid()), actionCollection(), "layout_grid"); + new KAction(i18n("&Break Layout"), TQString(), KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(breakLayout()), actionCollection(), "break_layout"); + + new KAction(i18n("Bring Widget to Front"), "raise", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(bringWidgetToFront()), actionCollection(), "format_raise"); + new KAction(i18n("Send Widget to Back"), "lower", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(sendWidgetToBack()), actionCollection(), "format_lower"); + + KActionMenu *alignMenu = new KActionMenu(i18n("Align Widgets' Positions"), "aopos2grid", actionCollection(), "align_menu"); + alignMenu->insert( new KAction(i18n("To Left"), "aoleft", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToLeft()), actionCollection(), "align_to_left") ); + alignMenu->insert( new KAction(i18n("To Right"), "aoright", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToRight()), actionCollection(), "align_to_right") ); + alignMenu->insert( new KAction(i18n("To Top"), "aotop", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToTop()), actionCollection(), "align_to_top") ); + alignMenu->insert( new KAction(i18n("To Bottom"), "aobottom", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToBottom()), actionCollection(), "align_to_bottom") ); + alignMenu->insert( new KAction(i18n("To Grid"), "aopos2grid", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(alignWidgetsToGrid()), actionCollection(), "align_to_grid") ); + + KActionMenu *sizeMenu = new KActionMenu(i18n("Adjust Widgets' Sizes"), "aogrid", actionCollection(), "adjust_size_menu"); + sizeMenu->insert( new KAction(i18n("To Fit"), "aofit", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustWidgetSize()), actionCollection(), "adjust_to_fit") ); + sizeMenu->insert( new KAction(i18n("To Grid"), "aogrid", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustSizeToGrid()), actionCollection(), "adjust_size_grid") ); + sizeMenu->insert( new KAction(i18n("To Shortest"), "aoshortest", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustHeightToSmall()), actionCollection(), "adjust_height_small") ); + sizeMenu->insert( new KAction(i18n("To Tallest"), "aotallest", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustHeightToBig()), actionCollection(), "adjust_height_big") ); + sizeMenu->insert( new KAction(i18n("To Narrowest"), "aonarrowest", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustWidthToSmall()), actionCollection(), "adjust_width_small") ); + sizeMenu->insert( new KAction(i18n("To Widest"), "aowidest", KShortcut(0), KFormDesigner::FormManager::self(), TQT_SLOT(adjustWidthToBig()), actionCollection(), "adjust_width_big") ); + + if(m_inShell) + setXMLFile("kformdesigner_part_shell.rc"); + else + setXMLFile("kformdesigner_part.rc"); + KFormDesigner::FormManager::self()->createActions(formsLibrary(), actionCollection(), this); +} + +void +KFormDesignerKDevPart::createBlankForm() +{ + if(KFormDesigner::FormManager::self()->activeForm() && m_uniqueFormMode) + { + m_openingFile = true; + closeURL(); + m_openingFile = false; + } + + if(m_uniqueFormMode && KFormDesigner::FormManager::self()->activeForm() && !KFormDesigner::FormManager::self()->activeForm()->isModified() && KFormDesigner::FormManager::self()->activeForm()->filename().isNull()) + return; // active form is already a blank one + + TQString n = i18n("Form") + TQString::number(++m_count); + Form *form = new Form(formsLibrary(), n.latin1()); + FormWidgetBase *w = new FormWidgetBase(this, m_workspace, n.latin1()); + + w->setCaption(n); + w->setIcon(SmallIcon("form")); + w->resize(350, 300); + w->show(); + w->setFocus(); + + form->createToplevel(w, w); + KFormDesigner::FormManager::self()->importForm(form); +} + +void +KFormDesignerKDevPart::open() +{ + m_openingFile = true; + KURL url = KFileDialog::getOpenURL("::kformdesigner", i18n("*.ui|TQt Designer UI Files"), m_workspace->tqtopLevelWidget()); + if(!url.isEmpty()) + ReadWritePart::openURL(url); + m_openingFile = false; +} + +bool +KFormDesignerKDevPart::openFile() +{ + Form *form = new Form(formsLibrary()); + FormWidgetBase *w = new FormWidgetBase(this, m_workspace); + form->createToplevel(w, w); + + if(!KFormDesigner::FormIO::loadForm(form, w, m_file)) + { + delete form; + delete w; + return false; + } + + w->show(); + KFormDesigner::FormManager::self()->importForm(form, !isReadWrite()); + return true; +} + +bool +KFormDesignerKDevPart::saveFile() +{ + KFormDesigner::FormIO::saveForm(KFormDesigner::FormManager::self()->activeForm(), m_file); + return true; +} + +void +KFormDesignerKDevPart::saveAs() +{ + KURL url = KFileDialog::getSaveURL("::kformdesigner", i18n("*.ui|TQt Designer UI Files"), m_workspace); + if(url.isEmpty()) + return; + else + ReadWritePart::saveAs(url); +} + +bool +KFormDesignerKDevPart::closeForm(Form *form) +{ + int res = KMessageBox::warningYesNoCancel( m_workspace->tqtopLevelWidget(), + i18n( "The form \"%1\" has been modified.\n" + "Do you want to save your changes or discard them?" ).tqarg( form->objectTree()->name() ), + i18n( "Close Form" ), KStdGuiItem::save(), KStdGuiItem::discard() ); + + if(res == KMessageBox::Yes) + save(); + + return (res != KMessageBox::Cancel); +} + +bool +KFormDesignerKDevPart::closeForms() +{ + TQWidgetList list = m_workspace->windowList(TQWorkspace::CreationOrder); + for(TQWidget *w = list.first(); w; w = list.next()) + if(w->close() == false) + return false; + + return true; +} + +bool +KFormDesignerKDevPart::closeURL() +{ + if(!KFormDesigner::FormManager::self()->activeForm()) + return true; + + if(m_uniqueFormMode || !m_openingFile) + return closeForms(); + + return true; +} + +void +KFormDesignerKDevPart::slotFormModified(Form *, bool isDirty) +{ + setModified(isDirty); +} + +void +KFormDesignerKDevPart::slotPreviewForm() +{ + if(!KFormDesigner::FormManager::self()->activeForm()) + return; + + FormWidgetBase *w = new FormWidgetBase(this, m_workspace); + KFormDesigner::FormManager::self()->previewForm(KFormDesigner::FormManager::self()->activeForm(), w); +} + +void +KFormDesignerKDevPart::slotWidgetSelected(Form *form, bool multiple) +{ + enableFormActions(); + // Enable edit actions + ENABLE_ACTION("edit_copy", true); + ENABLE_ACTION("edit_cut", true); + ENABLE_ACTION("edit_delete", true); + ENABLE_ACTION("clear_contents", true); + + // 'Align Widgets' menu + ENABLE_ACTION("align_menu", multiple); + ENABLE_ACTION("align_to_left", multiple); + ENABLE_ACTION("align_to_right", multiple); + ENABLE_ACTION("align_to_top", multiple); + ENABLE_ACTION("align_to_bottom", multiple); + + ENABLE_ACTION("adjust_size_menu", true); + ENABLE_ACTION("adjust_width_small", multiple); + ENABLE_ACTION("adjust_width_big", multiple); + ENABLE_ACTION("adjust_height_small", multiple); + ENABLE_ACTION("adjust_height_big", multiple); + + ENABLE_ACTION("format_raise", true); + ENABLE_ACTION("format_lower", true); + + // If the widgets selected is a container, we enable tqlayout actions + if(!multiple) + { + KFormDesigner::ObjectTreeItem *item = form->objectTree()->lookup( form->selectedWidgets()->first()->name() ); + if(item && item->container()) + multiple = true; + } + // Layout actions + ENABLE_ACTION("layout_hbox", multiple); + ENABLE_ACTION("layout_vbox", multiple); + ENABLE_ACTION("layout_grid", multiple); + + KFormDesigner::Container *container = KFormDesigner::FormManager::self()->activeForm()->activeContainer(); + ENABLE_ACTION("break_layout", (container->layoutType() != KFormDesigner::Container::NoLayout)); +} + +void +KFormDesignerKDevPart::slotFormWidgetSelected(Form *form) +{ + disableWidgetActions(); + enableFormActions(); + + // Layout actions + ENABLE_ACTION("layout_hbox", true); + ENABLE_ACTION("layout_vbox", true); + ENABLE_ACTION("layout_grid", true); + ENABLE_ACTION("break_layout", (form->toplevelContainer()->layoutType() != KFormDesigner::Container::NoLayout)); +} + +void +KFormDesignerKDevPart::slotNoFormSelected() +{ + disableWidgetActions(); + + // Disable paste action + ENABLE_ACTION("edit_paste", false); + + ENABLE_ACTION("edit_undo", false); + ENABLE_ACTION("edit_redo", false); + + // Disable 'Tools' actions + ENABLE_ACTION("pixmap_collection", false); + ENABLE_ACTION("form_connections", false); + ENABLE_ACTION("taborder", false); + ENABLE_ACTION("change_style", false); + + // Disable items in 'File' + ENABLE_ACTION("file_save", false); + ENABLE_ACTION("file_save_as", false); + ENABLE_ACTION("preview_form", false); +} + +void +KFormDesignerKDevPart::enableFormActions() +{ + // Enable 'Tools' actions + ENABLE_ACTION("pixmap_collection", true); + ENABLE_ACTION("form_connections", true); + ENABLE_ACTION("taborder", true); + ENABLE_ACTION("change_style", true); + + // Enable items in 'File' + ENABLE_ACTION("file_save", true); + ENABLE_ACTION("file_save_as", true); + ENABLE_ACTION("preview_form", true); + + ENABLE_ACTION("edit_paste", KFormDesigner::FormManager::self()->isPasteEnabled()); + ENABLE_ACTION("edit_select_all", true); +} + +void +KFormDesignerKDevPart::disableWidgetActions() +{ + // Disable edit actions + ENABLE_ACTION("edit_copy", false); + ENABLE_ACTION("edit_cut", false); + ENABLE_ACTION("edit_delete", false); + ENABLE_ACTION("clear_contents", false); + + // Disable format functions + ENABLE_ACTION("align_menu", false); + ENABLE_ACTION("align_to_left", false); + ENABLE_ACTION("align_to_right", false); + ENABLE_ACTION("align_to_top", false); + ENABLE_ACTION("align_to_bottom", false); + ENABLE_ACTION("adjust_size_menu", false); + ENABLE_ACTION("format_raise", false); + ENABLE_ACTION("format_lower", false); + + ENABLE_ACTION("layout_hbox", false); + ENABLE_ACTION("layout_vbox", false); + ENABLE_ACTION("layout_grid", false); + ENABLE_ACTION("break_layout", false); +} + +void +KFormDesignerKDevPart::setUndoEnabled(bool enabled, const TQString &text) +{ + KAction *undoAction = actionCollection()->action("edit_undo"); + if(undoAction) + { + undoAction->setEnabled(enabled); + if(!text.isNull()) + undoAction->setText(text); + } +} + +void +KFormDesignerKDevPart::setRedoEnabled(bool enabled, const TQString &text) +{ + KAction *redoAction = actionCollection()->action("edit_redo"); + if(redoAction) + { + redoAction->setEnabled(enabled); + if(!text.isNull()) + redoAction->setText(text); + } +} + +void +KFormDesignerKDevPart::slotCreateFormSlot(Form *form, const TQString &widget, const TQString &signal) +{ + Function f; + f.returnType = "void"; + f.function = widget + "_" + signal; + f.specifier = "non virtual"; + f.access = "public"; + f.type = ftTQtSlot; + emit addedFunction(designerType(), form->objectTree()->name(), f); +} + +KFormDesignerKDevPart::~KFormDesignerKDevPart() +{ +} + + +////// FormWidgetBase : helper widget to draw rects on top of widgets + +//tqrepaint all tqchildren widgets +static void repaintAll(TQWidget *w) +{ + TQObjectList *list = w->queryList(TQWIDGET_OBJECT_NAME_STRING); + TQObjectListIt it(*list); + for (TQObject *obj; (obj=it.current()); ++it ) { + static_cast(obj)->tqrepaint(); + } + delete list; +} + +void +FormWidgetBase::drawRects(const TQValueList &list, int type) +{ + TQPainter p; + p.begin(this, true); + bool unclipped = testWFlags( WPaintUnclipped ); + setWFlags( WPaintUnclipped ); + + if (prev_rect.isValid()) { + //redraw prev. selection's rectangle + p.drawPixmap( TQPoint(prev_rect.x()-2, prev_rect.y()-2), buffer, TQRect(prev_rect.x()-2, prev_rect.y()-2, prev_rect.width()+4, prev_rect.height()+4)); + } + p.setBrush(TQBrush::NoBrush); + if(type == 1) // selection rect + p.setPen(TQPen(white, 1, TQt::DotLine)); + else if(type == 2) // insert rect + p.setPen(TQPen(white, 2)); + p.setRasterOp(XorROP); + + prev_rect = TQRect(); + TQValueList::ConstIterator endIt = list.constEnd(); + for(TQValueList::ConstIterator it = list.constBegin(); it != endIt; ++it) { + p.drawRect(*it); + prev_rect = prev_rect.unite(*it); + } + + if (!unclipped) + clearWFlags( WPaintUnclipped ); + p.end(); +} + +void +FormWidgetBase::drawRect(const TQRect& r, int type) +{ + TQValueList l; + l.append(r); + drawRects(l, type); +} + +void +FormWidgetBase::initRect() +{ + repaintAll(this); + buffer.resize( width(), height() ); + buffer = TQPixmap::grabWindow( winId() ); + prev_rect = TQRect(); +} + +void +FormWidgetBase::clearRect() +{ + TQPainter p; + p.begin(this, true); + bool unclipped = testWFlags( WPaintUnclipped ); + setWFlags( WPaintUnclipped ); + + //redraw entire form surface + p.drawPixmap( TQPoint(0,0), buffer, TQRect(0,0,buffer.width(), buffer.height()) ); + + if (!unclipped) + clearWFlags( WPaintUnclipped ); + p.end(); + + repaintAll(this); +} + +void +FormWidgetBase::highlightWidgets(TQWidget *from, TQWidget *to)//, const TQPoint &point) +{ + TQPoint fromPoint, toPoint; + if(from && from->parentWidget() && (from != this)) + fromPoint = from->parentWidget()->mapTo(this, from->pos()); + if(to && to->parentWidget() && (to != this)) + toPoint = to->parentWidget()->mapTo(this, to->pos()); + + TQPainter p; + p.begin(this, true); + bool unclipped = testWFlags( WPaintUnclipped ); + setWFlags( WPaintUnclipped ); + + if (prev_rect.isValid()) { + //redraw prev. selection's rectangle + p.drawPixmap( TQPoint(prev_rect.x(), prev_rect.y()), buffer, TQRect(prev_rect.x(), prev_rect.y(), prev_rect.width(), prev_rect.height())); + } + + p.setPen( TQPen(TQt::red, 2) ); + + if(to) + { + TQPixmap pix1 = TQPixmap::grabWidget(from); + TQPixmap pix2 = TQPixmap::grabWidget(to); + + if((from != this) && (to != this)) + p.drawLine( from->parentWidget()->mapTo(this, from->tqgeometry().center()), to->parentWidget()->mapTo(this, to->tqgeometry().center()) ); + + p.drawPixmap(fromPoint.x(), fromPoint.y(), pix1); + p.drawPixmap(toPoint.x(), toPoint.y(), pix2); + + if(to == this) + p.drawRoundRect(2, 2, width()-4, height()-4, 4, 4); + else + p.drawRoundRect(toPoint.x(), toPoint.y(), to->width(), to->height(), 5, 5); + } + + if(from == this) + p.drawRoundRect(2, 2, width()-4, height()-4, 4, 4); + else + p.drawRoundRect(fromPoint.x(), fromPoint.y(), from->width(), from->height(), 5, 5); + + if((to == this) || (from == this)) + prev_rect = TQRect(0, 0, buffer.width(), buffer.height()); + else if(to) + { + prev_rect.setX( (fromPoint.x() < toPoint.x()) ? (fromPoint.x() - 5) : (toPoint.x() - 5) ); + prev_rect.setY( (fromPoint.y() < toPoint.y()) ? (fromPoint.y() - 5) : (toPoint.y() - 5) ); + prev_rect.setRight( (fromPoint.x() < toPoint.x()) ? (toPoint.x() + to->width() + 10) : (fromPoint.x() + from->width() + 10) ); + prev_rect.setBottom( (fromPoint.y() < toPoint.y()) ? (toPoint.y() + to->height() + 10) : (fromPoint.y() + from->height() + 10) ) ; + } + else + prev_rect = TQRect(fromPoint.x()- 5, fromPoint.y() -5, from->width() + 10, from->height() + 10); + + if (!unclipped) + clearWFlags( WPaintUnclipped ); + p.end(); +} + +void +FormWidgetBase::closeEvent(TQCloseEvent *ev) +{ + Form *form = KFormDesigner::FormManager::self()->formForWidget(this); + if(!form || !form->isModified() || !form->objectTree()) // == preview form + ev->accept(); + else + { + bool close = m_part->closeForm(form); + if(close) + ev->accept(); + else + ev->ignore(); + } +} + +K_EXPORT_COMPONENT_FACTORY(libkformdesigner_kdev_part, KFDFactory) + +#include "kfd_kdev_part.moc" + diff --git a/kexi/formeditor/tdevelop_plugin/kfd_kdev_part.h b/kexi/formeditor/tdevelop_plugin/kfd_kdev_part.h new file mode 100644 index 00000000..b6929e5c --- /dev/null +++ b/kexi/formeditor/tdevelop_plugin/kfd_kdev_part.h @@ -0,0 +1,142 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Cedric Pasteur + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef KFORMDESIGNER_KDEVELOP_PART_H +#define KFORMDESIGNER_KDEVELOP_PART_H + +#include +#include + +#include +#include + +#include "form.h" + +class KAboutData; +class KInstance; +class TQWorkspace; +class TQCloseEvent; + +using KFormDesigner::Form; +using namespace KInterfaceDesigner; + +class KFORMEDITOR_EXPORT KFDFactory : public KParts::Factory +{ + Q_OBJECT + TQ_OBJECT + + public: + KFDFactory(); + virtual ~KFDFactory(); + + virtual KParts::Part* createPartObject(TQWidget *parentWidget=0, const char *widgetName=0, TQObject *parent=0, const char *name=0, + const char *classname="KParts::Part", const TQStringList &args=TQStringList()); + + static KInstance *instance(); + static KAboutData *aboutData(); + + private: + static KInstance *m_instance; +}; + +class KFORMEDITOR_EXPORT KFormDesignerKDevPart : public Designer +{ + Q_OBJECT + TQ_OBJECT + + public: + KFormDesignerKDevPart(TQWidget *parent, const char *name, bool readOnly=true, const TQStringList &args=TQStringList()); + virtual ~KFormDesignerKDevPart(); + + virtual DesignerType designerType() { return TQtDesigner; } + virtual void openProject(const TQString &) {} + +// KFormDesigner::FormManager* manager() { return m_manager; } + void setUniqueFormMode(bool enable) { m_uniqueFormMode = enable; } + + bool closeForm(Form *form); + bool closeForms(); + + virtual bool closeURL(); + + static KFormDesigner::WidgetLibrary* formsLibrary(); + + public slots: + /*! Creates a new blank Form. The new Form is shown and become the active Form. */ + void createBlankForm(); + /*! Loads a Form from a UI file. A "Open File" dialog is shown to select the file. The loaded Form is shown and becomes + the active Form. */ + void open(); + void slotPreviewForm(); + void saveAs(); + void slotCreateFormSlot(KFormDesigner::Form *form, const TQString &widget, const TQString &signal); + + protected slots: + void slotWidgetSelected(KFormDesigner::Form *form, bool multiple); + void slotFormWidgetSelected(KFormDesigner::Form *form); + void slotNoFormSelected(); + void slotFormModified(KFormDesigner::Form *form, bool isDirty); + void setUndoEnabled(bool enabled, const TQString &text); + void setRedoEnabled(bool enabled, const TQString &text); + + protected: + virtual bool openFile(); + virtual bool saveFile(); + void disableWidgetActions(); + void enableFormActions(); + void setupActions(); + + private: + static KFormDesigner::WidgetLibrary* static_formsLibrary; +// KFormDesigner::FormManager *m_manager; + TQWorkspace *m_workspace; + int m_count; + bool m_uniqueFormMode; + bool m_openingFile; + bool m_inShell; +}; + +//! Helper: this widget is used to create form's surface +class KFORMEDITOR_EXPORT FormWidgetBase : public TQWidget, public KFormDesigner::FormWidget +{ + Q_OBJECT + TQ_OBJECT + + public: + FormWidgetBase(KFormDesignerKDevPart *part, TQWidget *parent = 0, const char *name = 0, int WFlags = WDestructiveClose) + : TQWidget(parent, name, WFlags), m_part(part) {} + ~FormWidgetBase() {;} + + void drawRect(const TQRect& r, int type); + void drawRects(const TQValueList &list, int type); + void initRect(); + void clearRect(); + void highlightWidgets(TQWidget *from, TQWidget *to);//, const TQPoint &p); + + protected: + void closeEvent(TQCloseEvent *ev); + + private: + TQPixmap buffer; //!< stores grabbed entire form's area for redraw + TQRect prev_rect; //!< previously selected rectangle + KFormDesignerKDevPart *m_part; +}; + +#endif + diff --git a/kexi/formeditor/tdevelop_plugin/kformdesigner_kdev_part.desktop b/kexi/formeditor/tdevelop_plugin/kformdesigner_kdev_part.desktop new file mode 100644 index 00000000..c94e628f --- /dev/null +++ b/kexi/formeditor/tdevelop_plugin/kformdesigner_kdev_part.desktop @@ -0,0 +1,50 @@ +[Desktop Entry] +Name=Form Designer KDevelop Plugin +Name[bg]=Приставка на KDevelop за проектиране на форми +Name[ca]=Endollat de disseny de formulari de KDevelop +Name[cy]=Ategyn KDevelop: Dylunydd Ffurflenni +Name[da]=Form Designer KDEvelop-plugin +Name[de]=KDevelop-Modul zum Formularentwurf +Name[el]=Πρόσθετο σχεδίασης φόρμας του KDevelop +Name[eo]=Formulardesegnila kromaĵo por KDevelop +Name[es]=Complemento de diseñador de formularios de KDevelop +Name[et]=Vormikujundaja KDevelopi plugin +Name[eu]=Formularioak diseinatzeko KDevelop-en plugina +Name[fa]=وصلۀ KDevelop طراح برگه +Name[fi]=KDevelopin lomakkeen suunnittelija -liitännäinen +Name[fr]=Module externe KDevelop de composition d'interfaces graphiques +Name[fy]=KDevelop-plugin FormDesigner +Name[gl]=Plugin de Deseño de Formularios para Kdevelop +Name[he]=תוסף מעצב טפסים ל־KDevelop +Name[hr]=KDevelop dodatak dizajnera obrazaca +Name[hu]=Űrlaptervező modul a KDevelophoz +Name[is]=Form hönnunar KDevelop íforrit +Name[it]=Plugin di KDevelop per il progetto dei moduli +Name[ja]=フォームデザイナー Kdevelop プラグイン +Name[km]=កម្មវិធី​ជំនួយ​កម្មវិធី​រចនា​សំណុំបែបបទ​សម្រាប់ KDevelop +Name[lv]=KDevelop formu veidošanas spraudnis +Name[ms]=Plugin KDevelop Pereka Bentuk Borang +Name[nb]=KDevelop-tillegg for skjemautforming +Name[nds]=KDevelop-Moduul för't Opstellen vun Kiekwarken +Name[ne]=फारम डिजाइनकर्ता केडीई विकास प्लगइन +Name[nl]=KDevelop-plugin FormDesigner +Name[nn]=KDevelop-tillegg for skjemautforming +Name[pl]=Wtyczka projektanta formularzy dla KDevelop +Name[pt]='Plugin' para o KDevelop de Desenho de Formulários +Name[pt_BR]=Plugin do Desenhista de Formulário do KDevelop +Name[ru]=Модуль форм KDevelop +Name[sk]=KDevelop modul na vytváranie formulárov (Form Designer) +Name[sl]=Vstavek za oblikovanje obrazcev za KDevelop +Name[sr]=Прикључак дизајнера форми за KDevelop +Name[sr@Latn]=Priključak dizajnera formi za KDevelop +Name[sv]=KDevelop insticksprogram för formulärkonstruktion +Name[ta]=படிவ வடிவமைப்பாளர் கேடெவெலப் சொருகுப்பொருள் +Name[tr]=FormTasarımcısı KDevelop Eklentisi +Name[uk]=Втулок дизайнера форм KDevelop +Name[zh_CN]=表单设计器 KDevelop 插件 +Name[zh_TW]=表單設計師 KDevelop 外掛程式 +MimeType=application/x-designer; +ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart +X-KDE-Library=libkformdesigner_kdev_part +Type=Service +InitialPreference=0 diff --git a/kexi/formeditor/tdevelop_plugin/kformdesigner_part.rc b/kexi/formeditor/tdevelop_plugin/kformdesigner_part.rc new file mode 100644 index 00000000..3cadda53 --- /dev/null +++ b/kexi/formeditor/tdevelop_plugin/kformdesigner_part.rc @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + &Widgets + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &Format + + + + + + + + + + + + + + + +Main Toolbar + + + + + + + + + + + + + Containers + + + + + + + + Widgets + + + + + + + + + + + + + + + + + + + + + + + + +Tools Toolbar + + + + +Format Toolbar + + + + + \ No newline at end of file diff --git a/kexi/formeditor/tdevelop_plugin/kformdesigner_part_shell.rc b/kexi/formeditor/tdevelop_plugin/kformdesigner_part_shell.rc new file mode 100644 index 00000000..8b592752 --- /dev/null +++ b/kexi/formeditor/tdevelop_plugin/kformdesigner_part_shell.rc @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &Widgets + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &Format + + + + + + + + + + + + + + + +Main Toolbar + + + + + + + + + + + + + + + + Containers + + + + + + + + Widgets + + + + + + + + + + + + + + + + + + + + + + + + +Tools Toolbar + + + + +Format Toolbar + + + + + \ No newline at end of file -- cgit v1.2.1