From: arif Date: Fri, 18 Feb 2011 15:24:13 +0000 (+0000) Subject: new qt-based gvedit X-Git-Tag: LAST_LIBGRAPH~32^2~1025 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4466553c5a976e039b1f4f4fa32efaffb3c77af0;p=graphviz new qt-based gvedit --- diff --git a/cmd/gvedit/document1.png b/cmd/gvedit/document1.png new file mode 100644 index 000000000..944a149da Binary files /dev/null and b/cmd/gvedit/document1.png differ diff --git a/cmd/gvedit/document2.png b/cmd/gvedit/document2.png new file mode 100644 index 000000000..3739e2bc9 Binary files /dev/null and b/cmd/gvedit/document2.png differ diff --git a/cmd/gvedit/gvedit.ncb b/cmd/gvedit/gvedit.ncb index 3c8813ce9..61c2060d7 100644 Binary files a/cmd/gvedit/gvedit.ncb and b/cmd/gvedit/gvedit.ncb differ diff --git a/cmd/gvedit/gvedit.vcproj b/cmd/gvedit/gvedit.vcproj index 7515449aa..c1471f77d 100644 --- a/cmd/gvedit/gvedit.vcproj +++ b/cmd/gvedit/gvedit.vcproj @@ -201,6 +201,10 @@ > + + diff --git a/cmd/gvedit/main.cpp b/cmd/gvedit/main.cpp index c47fac125..0adf54873 100644 --- a/cmd/gvedit/main.cpp +++ b/cmd/gvedit/main.cpp @@ -38,10 +38,22 @@ ** ****************************************************************************/ +#include "windows.h" #include #include "mainwindow.h" +#ifdef WIN32_DLL +__declspec(dllimport) boolean MemTest; +/*gvc.lib cgraph.lib*/ +#ifdef WITH_CGRAPH + #pragma comment( lib, "cgraph.lib" ) +#else + #pragma comment( lib, "graph.lib" ) +#endif + #pragma comment( lib, "gvc.lib" ) +#endif + int main(int argc, char *argv[]) { Q_INIT_RESOURCE(mdi); diff --git a/cmd/gvedit/mainwindow.cpp b/cmd/gvedit/mainwindow.cpp index 72d191935..9a6d0147d 100644 --- a/cmd/gvedit/mainwindow.cpp +++ b/cmd/gvedit/mainwindow.cpp @@ -42,6 +42,8 @@ #include "mainwindow.h" #include "mdichild.h" +#include "csettings.h" + MainWindow::MainWindow() { @@ -55,6 +57,8 @@ MainWindow::MainWindow() connect(windowMapper, SIGNAL(mapped(QWidget*)), this, SLOT(setActiveSubWindow(QWidget*))); + frmSettings= new CFrmSettings(); + createActions(); createMenus(); createToolBars(); @@ -149,6 +153,16 @@ void MainWindow::about() "document interface applications using Qt.")); } + +void MainWindow::settings() +{ + frmSettings->showSettings(activeMdiChild()); + +} + + + + void MainWindow::updateMenus() { bool hasMdiChild = (activeMdiChild() != 0); @@ -186,28 +200,32 @@ void MainWindow::updateWindowMenu() separatorAct->setVisible(!windows.isEmpty()); for (int i = 0; i < windows.size(); ++i) { - MdiChild *child = qobject_cast(windows.at(i)->widget()); - - QString text; - if (i < 9) { - text = tr("&%1 %2").arg(i + 1) + if (typeid(windows.at(i)->widget()).name()=="MdiChild") + { + MdiChild *child = qobject_cast(windows.at(i)->widget()); + QString text; + if (i < 9) { + text = tr("&%1 %2").arg(i + 1) .arg(child->userFriendlyCurrentFile()); - } else { - text = tr("%1 %2").arg(i + 1) - .arg(child->userFriendlyCurrentFile()); - } - QAction *action = windowMenu->addAction(text); - action->setCheckable(true); - action ->setChecked(child == activeMdiChild()); - connect(action, SIGNAL(triggered()), windowMapper, SLOT(map())); - windowMapper->setMapping(action, windows.at(i)); + } else { + text = tr("%1 %2").arg(i + 1) + .arg(child->userFriendlyCurrentFile()); + } + QAction *action = windowMenu->addAction(text); + action->setCheckable(true); + action ->setChecked(child == activeMdiChild()); + connect(action, SIGNAL(triggered()), windowMapper, SLOT(map())); + windowMapper->setMapping(action, windows.at(i)); + } } } MdiChild *MainWindow::createMdiChild() { MdiChild *child = new MdiChild; + child->parentFrm=this; mdiArea->addSubWindow(child); + connect(child, SIGNAL(copyAvailable(bool)), cutAct, SLOT(setEnabled(bool))); @@ -305,6 +323,19 @@ void MainWindow::createActions() aboutQtAct = new QAction(tr("About &Qt"), this); aboutQtAct->setStatusTip(tr("Show the Qt library's About box")); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); + + + settingsAct = new QAction(tr("Settings"), this); + settingsAct->setStatusTip(tr("Show Graphviz Settings")); + connect(settingsAct, SIGNAL(triggered()), this, SLOT(settings())); + + + + layoutAct = new QAction(QIcon(":/images/cut.png"),tr("Layout"), this); + layoutAct->setStatusTip(tr("Layout the active graph")); + connect(layoutAct, SIGNAL(triggered()), this, SLOT(about())); + + } void MainWindow::createMenus() @@ -324,6 +355,10 @@ void MainWindow::createMenus() editMenu->addAction(copyAct); editMenu->addAction(pasteAct); + graphMenu = menuBar()->addMenu (tr("&Graph")); + graphMenu->addAction(settingsAct); + graphMenu->addAction(layoutAct); + windowMenu = menuBar()->addMenu(tr("&Window")); updateWindowMenu(); connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowMenu())); @@ -346,6 +381,11 @@ void MainWindow::createToolBars() editToolBar->addAction(cutAct); editToolBar->addAction(copyAct); editToolBar->addAction(pasteAct); + + graphToolBar = addToolBar(tr("Graph")); + graphToolBar->addAction(settingsAct); + graphToolBar->addAction(layoutAct); + } void MainWindow::createStatusBar() diff --git a/cmd/gvedit/mainwindow.h b/cmd/gvedit/mainwindow.h index bd2135781..2d77e39f9 100644 --- a/cmd/gvedit/mainwindow.h +++ b/cmd/gvedit/mainwindow.h @@ -1,49 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include +#include "ui_settings.h" class MdiChild; +class CFrmSettings; QT_BEGIN_NAMESPACE class QAction; class QMenu; @@ -58,6 +21,7 @@ class MainWindow : public QMainWindow public: MainWindow(); + QMdiArea *mdiArea; protected: void closeEvent(QCloseEvent *event); @@ -76,6 +40,7 @@ private slots: MdiChild *createMdiChild(); void switchLayoutDirection(); void setActiveSubWindow(QWidget *window); + void settings(); private: void createActions(); @@ -87,15 +52,18 @@ private: MdiChild *activeMdiChild(); QMdiSubWindow *findMdiChild(const QString &fileName); - QMdiArea *mdiArea; QSignalMapper *windowMapper; + + QMenu *fileMenu; QMenu *editMenu; + QMenu *graphMenu; QMenu *windowMenu; QMenu *helpMenu; QToolBar *fileToolBar; QToolBar *editToolBar; + QToolBar *graphToolBar; QAction *newAct; QAction *openAct; QAction *saveAct; @@ -113,6 +81,12 @@ private: QAction *separatorAct; QAction *aboutAct; QAction *aboutQtAct; + + QAction *settingsAct; + QAction *layoutAct; + + + CFrmSettings* frmSettings; }; #endif diff --git a/cmd/gvedit/mdi.vcproj b/cmd/gvedit/mdi.vcproj index c005c8e44..3ea8621a7 100644 --- a/cmd/gvedit/mdi.vcproj +++ b/cmd/gvedit/mdi.vcproj @@ -4,6 +4,7 @@ Version="9.00" Name="mdi" ProjectGUID="{F493EC02-F24B-3211-8666-ABA635BA96CE}" + RootNamespace="mdi" Keyword="Qt4VSv1.0" TargetFrameworkVersion="0" > @@ -45,12 +46,12 @@ Name="VCCLCompilerTool" AdditionalOptions="-Zm200 -w34100 -w34189" Optimization="4" - AdditionalIncludeDirectories=""$(QTDIR)\include\QtCore","$(QTDIR)\include\QtGui","$(QTDIR)\include","$(QTDIR)\include\ActiveQt","debug",..\..\..\..\Qt\4.7.0\mkspecs\default" - PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT" + AdditionalIncludeDirectories=""$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\ActiveQt";debug;..\..\..\..\Qt\4.7.0\mkspecs\default;.\GeneratedFiles;..\..\lib\common;..\..\lib\pathplan;..\..\lib\cdt;..\..\lib\graph;"$(SolutionDir)/";..\..\lib\gvc" + PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;HAVE_CONFIG_H;WIN32_DLL;DEMAND_LOADING;QT_LARGEFILE_SUPPORT;QT_DLL;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT" GeneratePreprocessedFile="0" ExceptionHandling="1" RuntimeLibrary="3" - BufferSecurityCheck="false" + BufferSecurityCheck="true" TreatWChar_tAsBuiltInType="false" RuntimeTypeInfo="true" AssemblerListingLocation="debug\" @@ -74,13 +75,14 @@ Name="VCLinkerTool" IgnoreImportLibrary="true" AdditionalOptions=""/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'"" - AdditionalDependencies="qtmaind.lib QtGuid4.lib QtCored4.lib" - OutputFile="debug\mdi.exe" + AdditionalDependencies="qtmaind.lib QtGuid4.lib QtCored4.lib " + OutputFile="c:/graphviz-ms/bin/$(ProjectName).exe" SuppressStartupBanner="true" - AdditionalLibraryDirectories="$(QTDIR)\lib" + AdditionalLibraryDirectories=""C:\graphviz-ms\bin";"$(QTDIR)\lib"" + IgnoreDefaultLibraryNames="" GenerateDebugInformation="true" ProgramDatabaseFile="" - SubSystem="2" + SubSystem="1" LinkTimeCodeGeneration="0" /> + + + + @@ -224,7 +234,7 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -336,6 +426,30 @@ Filter="cpp;moc" SourceControlFiles="false" > + + + + + + + + + + @@ -515,6 +629,38 @@ + + + + + + + + + + #include "mdichild.h" +#include "mainwindow.h" MdiChild::MdiChild() { setAttribute(Qt::WA_DeleteOnClose); isUntitled = true; + layoutIdx=0; + renderIdx=0; + preview=true; + applyCairo=false; + previewFrm=NULL; } void MdiChild::newFile() @@ -173,3 +179,16 @@ QString MdiChild::strippedName(const QString &fullFileName) { return QFileInfo(fullFileName).fileName(); } + +void MdiChild::loadPreview(QString fileName) +{ + if (!this->previewFrm) + { + previewFrm=new ImageViewer(); + parentFrm->mdiArea->addSubWindow(previewFrm); + } + previewFrm->open(fileName); + previewFrm->show(); + +} + diff --git a/cmd/gvedit/mdichild.h b/cmd/gvedit/mdichild.h index 95f99c85b..fa5f7e4e3 100644 --- a/cmd/gvedit/mdichild.h +++ b/cmd/gvedit/mdichild.h @@ -42,6 +42,8 @@ #define MDICHILD_H #include +#include "imageviewer.h" +class MainWindow; class MdiChild : public QTextEdit { @@ -57,7 +59,15 @@ public: bool saveFile(const QString &fileName); QString userFriendlyCurrentFile(); QString currentFile() { return curFile; } - + int layoutIdx; + int renderIdx; + QString outputFile; + bool preview; + bool applyCairo; + QString attributes; + ImageViewer* previewFrm; + MainWindow* parentFrm; + void loadPreview(QString fileName); protected: void closeEvent(QCloseEvent *event); diff --git a/cmd/gvedit/ui/main.ui b/cmd/gvedit/ui/main.ui new file mode 100644 index 000000000..d1c7d60b4 --- /dev/null +++ b/cmd/gvedit/ui/main.ui @@ -0,0 +1,388 @@ + + + MainWindow + + + + 0 + 0 + 1076 + 839 + + + + MainWindow + + + + + 1 + + + 1 + + + + + + + 0 + 0 + 1076 + 21 + + + + + File + + + + + + + + + + + + + Graph + + + + + + + View + + + + + + + + + Plugins + + + + + + Windows + + + + + + + + Help + + + + + + + + + + + + + + + + 240 + 32 + + + + toolBar + + + TopToolBarArea + + + false + + + + + + + + + + + 0 + 0 + + + + + 34 + 0 + + + + toolBar_2 + + + LeftToolBarArea + + + false + + + + + + + + + + toolBar_3 + + + TopToolBarArea + + + false + + + + + + + + + + + ../../../../../Qt/4.7.0/src/gui/styles/images/New.gif../../../../../Qt/4.7.0/src/gui/styles/images/New.gif + + + New + + + Create A New Graph + + + + + + ../../../../../Qt/4.7.0/src/gui/styles/images/OpenDoc.gif../../../../../Qt/4.7.0/src/gui/styles/images/OpenDoc.gif + + + Open + + + Open An Existing Graph + + + + + + ../../../../../Qt/4.7.0/src/gui/styles/images/SaveC.gif../../../../../Qt/4.7.0/src/gui/styles/images/SaveC.gif + + + Save + + + Save Active Graph + + + + + + ../../../../../../Qt/4.7.0/src/gui/styles/images/standardbutton-save-as-32.png../../../../../../Qt/4.7.0/src/gui/styles/images/standardbutton-save-as-32.png + + + Save As... + + + Save Active Graph Under A New Name + + + + + + :/images/images/export.gif:/images/images/export.gif + + + Export + + + Export Graph To Different File Formats + + + + + Quit + + + Quit Application + + + + + + ../../../../../../Qt/4.7.0/src/gui/styles/images/desktop-32.png../../../../../../Qt/4.7.0/src/gui/styles/images/desktop-32.png + + + Graph Settings... + + + + + + ../../smyrna-qt/images/Sheet.gif../../smyrna-qt/images/Sheet.gif + + + Attributes + + + View / Modify Graph Attributes + + + + + + ../../smyrna-qt/images/scripts.gif../../smyrna-qt/images/scripts.gif + + + Scripts + + + Open Script Manager + + + + + + ../../smyrna-qt/images/InsInst.gif../../smyrna-qt/images/InsInst.gif + + + Layouts + + + + + + ../../smyrna-qt/images/BarGraph.gif../../smyrna-qt/images/BarGraph.gif + + + Stats + + + + + + ../../smyrna-qt/images/cursor-sizef.png../../smyrna-qt/images/cursor-sizef.png + + + Fit In Screen + + + + + + ../../smyrna-qt/images/zoom-in-32.png../../smyrna-qt/images/zoom-in-32.png + + + Zoom In + + + + + + ../../smyrna-qt/images/zoom-out-32.png../../smyrna-qt/images/zoom-out-32.png + + + Zoom Out + + + + + + ../../smyrna-qt/images/3D-view.png../../smyrna-qt/images/3D-view.png + + + Switch To 3D + + + + + + ../../smyrna-qt/images/fisheye.png../../smyrna-qt/images/fisheye.png + + + Switch to Fisheye Layout + + + + + Plugin Manager + + + + + Maximize + + + + + Tile + + + + + Cascade + + + + + Smyrna Help... + + + + + About + + + + + Layout Settings + + + + + Layout + + + + + + + + + actionNew + activated() + MainWindow + slotNewGraph() + + + -1 + -1 + + + 537 + 419 + + + + + + slotNewGraph() + + diff --git a/cmd/gvedit/ui/settings.ui b/cmd/gvedit/ui/settings.ui new file mode 100644 index 000000000..0add9cffd --- /dev/null +++ b/cmd/gvedit/ui/settings.ui @@ -0,0 +1,614 @@ + + + Dialog + + + + 0 + 0 + 405 + 512 + + + + Dialog + + + + + 0 + 0 + 401 + 181 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + 2 + + + + + 10 + 10 + 381 + 161 + + + + + + + + + + + + 120 + 0 + + + + Layout Engine + + + 5 + + + + + + + + 150 + 0 + + + + + dot + + + + + circo + + + + + fdp + + + + + neato + + + + + nop + + + + + nop1 + + + + + nop2 + + + + + osage + + + + + patchwork + + + + + sfdp + + + + + twopi + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 120 + 0 + + + + Output file Type + + + 5 + + + + + + + + 150 + 0 + + + + + png + + + + + jpg + + + + + ps + + + + + dot + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 120 + 0 + + + + Output File Name + + + 5 + + + + + + + true + + + + + + + + 50 + 16777215 + + + + ... + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Preview Output File + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Apply Cairo Filters + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 180 + 401 + 71 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 10 + 0 + 381 + 62 + + + + + + + + + + + Scope + + + + + + + + graph + + + + + node + + + + + edge + + + + + + + + Name + + + + + + + + color + + + + + Font + + + + + fontname + + + + + fontcolor + + + + + bgcolor + + + + + + + + + + + + + 40 + 0 + + + + + 47 + 16777215 + + + + Value + + + + + + + + + + + + + + + + + 75 + 0 + + + + Add + + + + + + + Qt::Vertical + + + + 20 + 13 + + + + + + + + + 75 + 0 + + + + Help + + + + + + + + + + + + 0 + 250 + 401 + 261 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 7 + 6 + 391 + 251 + + + + + + + + + + + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + clear + + + + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + load + + + + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + save + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Cancel + + + + + + + OK + + + + + + + + + + + + + CSettingsOK + + + + + + diff --git a/cmd/gvedit/vc90.idb b/cmd/gvedit/vc90.idb index bd8a53021..bb4a2c9d4 100644 Binary files a/cmd/gvedit/vc90.idb and b/cmd/gvedit/vc90.idb differ diff --git a/cmd/gvedit/vc90.pdb b/cmd/gvedit/vc90.pdb index 790a0c5ad..6cfc3e1a2 100644 Binary files a/cmd/gvedit/vc90.pdb and b/cmd/gvedit/vc90.pdb differ