]> granicus.if.org Git - graphviz/commitdiff
gvedit development
authorarif <devnull@localhost>
Tue, 1 Mar 2011 19:10:51 +0000 (19:10 +0000)
committerarif <devnull@localhost>
Tue, 1 Mar 2011 19:10:51 +0000 (19:10 +0000)
12 files changed:
cmd/gvedit/csettings.cpp
cmd/gvedit/mainwindow.cpp
cmd/gvedit/mainwindow.h
cmd/gvedit/mdi.qrc
cmd/gvedit/mdi.vcproj
cmd/gvedit/mdi.vcproj.RESEARCH.arif.user
cmd/gvedit/mdichild.cpp
cmd/gvedit/mdichild.h
cmd/gvedit/ui/settings.ui
cmd/gvedit/ui_settings.h
cmd/gvedit/vc90.idb
cmd/gvedit/vc90.pdb

index b711744fac33fbfe5e8dee52855d7a6c340e3703..acc19fc8f5f5255f4a1fbd0c8f8878a924716454 100644 (file)
@@ -74,11 +74,30 @@ QString stripFileExtension(QString fileName)
 
 char* graph_reader( char * str, int num, FILE * stream ) //helper function to load / parse graphs from tstring
 {
+    if (num==0)
+       return str;
+    char bf[36000];
+    char* ptr;
+    int l=0;
     CFrmSettings* s=reinterpret_cast<CFrmSettings*>(stream); //as ugly as it gets :)
-    if (s->cur >= strlen(s->graphData.toUtf8().constData()))
+    if(s->cur >=strlen(s->graphData.toUtf8().constData()))
        return NULL;
-    strcpy(str,(char*)s->graphData.mid(s->cur,num).toUtf8().constData());
-    s->cur=s->cur+num;
+    strcpy(bf,(char*)s->graphData.mid(s->cur,num).toUtf8().constData());
+    ptr=strchr(bf,'\n');
+    if((ptr) && ((ptr - bf) < num))
+    {
+       l=ptr - bf;
+    }
+    else
+    {
+       if(strlen(bf) > (num-1))
+           l=num-1;
+       else
+           l=strlen(bf);
+    }
+    strncpy(str,bf,l);
+    str[l]=(char*)0;
+    s->cur=s->cur+l+1;
     return str;
 
 }
@@ -98,6 +117,7 @@ CFrmSettings::CFrmSettings()
     connect(WIDGET(QPushButton,pbOpen),SIGNAL(clicked()),this,SLOT(openSlot()));
     connect(WIDGET(QPushButton,pbSave),SIGNAL(clicked()),this,SLOT(saveSlot()));
     connect(WIDGET(QPushButton,btnOK),SIGNAL(clicked()),this,SLOT(okSlot()));
+    connect(WIDGET(QPushButton,btnCancel),SIGNAL(clicked()),this,SLOT(cancelSlot()));
     connect(WIDGET(QPushButton,pbOut),SIGNAL(clicked()),this,SLOT(outputSlot()));
     connect(WIDGET(QComboBox,cbScope),SIGNAL(currentIndexChanged(int)),this,SLOT(scopeChangedSlot(int)));
 
@@ -155,7 +175,10 @@ void CFrmSettings::addSlot()
     }
 }
 void CFrmSettings::helpSlot(){}
-void CFrmSettings::cancelSlot(){}
+void CFrmSettings::cancelSlot()
+{
+    this->reject();
+}
 void CFrmSettings::okSlot()
 {
     saveContent();
@@ -243,6 +266,7 @@ bool CFrmSettings::createLayout()
        * If known, might want to use real name
        */
     agsetfile("<gvedit>");
+    cur=0;
     graph=agread_usergets(reinterpret_cast<FILE*>(this),(gets_f)graph_reader);
     if(!graph)
        return false;
@@ -306,6 +330,7 @@ int CFrmSettings::drawGraph()
 {
            createLayout();
            renderLayout();
+           getActiveWindow()->settingsSet=false;
            return QDialog::Accepted;
 
 }
index e2da8d56bc368acb3148eb793e7d26c997be0d8e..dbebc5e2a1714200959ba08a7838991509a02f13 100644 (file)
@@ -195,6 +195,15 @@ void CMainWindow::slotSettings()
 {
     frmSettings->showSettings(activeMdiChild());
 
+}
+void CMainWindow::slotRun()
+{
+    if((activeMdiChild()) && (!activeMdiChild()->firstTime()))
+       frmSettings->runSettings(activeMdiChild());
+    if((activeMdiChild()) && (activeMdiChild()->firstTime()))
+       frmSettings->showSettings(activeMdiChild());
+
+
 }
 
 void CMainWindow::updateFileMenu()
@@ -386,15 +395,15 @@ void CMainWindow::actions()
     connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
 
 
-    settingsAct = new QAction(tr("Settings"), this);
+    settingsAct = new QAction(QIcon(":/images/settings.png"),tr("Settings"), this);
     settingsAct->setStatusTip(tr("Show Graphviz Settings"));
     connect(settingsAct, SIGNAL(triggered()), this, SLOT(slotSettings()));
 
 
 
-    layoutAct = new QAction(QIcon(":/images/cut.png"),tr("Layout"), this);
+    layoutAct = new QAction(QIcon(":/images/run.png"),tr("Layout"), this);
     layoutAct->setStatusTip(tr("Layout the active graph"));
-    connect(layoutAct, SIGNAL(triggered()), this, SLOT(slotAbout()));
+    connect(layoutAct, SIGNAL(triggered()), this, SLOT(slotRun()));
 
 
 }
index dc9e32d4815d9cad3fffd36732c5da606c232d7b..24c937961a273881479966570c5bf23dbdead941 100644 (file)
@@ -42,6 +42,7 @@ public:
 
 private slots:
     void slotSettings();
+    void slotRun();
     void slotNew();
     void slotOpen();
     void slotSave();
index 0a776fab4d3c4e6b672714d7b582193f1800bf53..9001e7da7d14e14103d35f27be06afd3506a0944 100644 (file)
@@ -1,10 +1,12 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
-    <file>images/copy.png</file>
-    <file>images/cut.png</file>
-    <file>images/new.png</file>
-    <file>images/open.png</file>
-    <file>images/paste.png</file>
-    <file>images/save.png</file>
-</qresource>
+<RCC>
+    <qresource prefix="/">
+        <file>images/copy.png</file>
+        <file>images/cut.png</file>
+        <file>images/new.png</file>
+        <file>images/open.png</file>
+        <file>images/paste.png</file>
+        <file>images/save.png</file>
+        <file>images/run.png</file>
+        <file>images/settings.png</file>
+    </qresource>
 </RCC>
index 56253105d66c716696a54983ea1eeba9bda47107..3daea053ef0bf1fe90056447925775d27586abc1 100644 (file)
                                                Name="VCCustomBuildTool"
                                                Description="Rcc&apos;ing $(InputFileName)..."
                                                CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -name &quot;$(InputName)&quot; -no-compress &quot;$(InputPath)&quot; -o .\GeneratedFiles\qrc_$(InputName).cpp&#x0D;&#x0A;"
-                                               AdditionalDependencies="$(InputPath);.\images\copy.png;.\images\cut.png;.\images\new.png;.\images\open.png;.\images\paste.png;.\images\save.png"
+                                               AdditionalDependencies="$(InputPath);.\images\copy.png;.\images\cut.png;.\images\new.png;.\images\open.png;.\images\paste.png;.\images\save.png;.\images\run.png;.\images\settings.png"
                                                Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
                                        />
                                </FileConfiguration>
                                                Name="VCCustomBuildTool"
                                                Description="Rcc&apos;ing $(InputFileName)..."
                                                CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -name &quot;$(InputName)&quot; -no-compress &quot;$(InputPath)&quot; -o .\GeneratedFiles\qrc_$(InputName).cpp&#x0D;&#x0A;"
-                                               AdditionalDependencies="$(InputPath);.\images\copy.png;.\images\cut.png;.\images\new.png;.\images\open.png;.\images\paste.png;.\images\save.png"
+                                               AdditionalDependencies="$(InputPath);.\images\copy.png;.\images\cut.png;.\images\new.png;.\images\open.png;.\images\paste.png;.\images\save.png;.\images\run.png;.\images\settings.png"
                                                Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
                                        />
                                </FileConfiguration>
                                        />
                                </FileConfiguration>
                        </File>
+                       <File
+                               RelativePath=".\images\run.png"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                       />
+                               </FileConfiguration>
+                       </File>
                        <File
                                RelativePath=".\images\save.png"
                                >
                                        />
                                </FileConfiguration>
                        </File>
+                       <File
+                               RelativePath=".\images\settings.png"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                       />
+                               </FileConfiguration>
+                       </File>
                </Filter>
                <Filter
                        Name="Form Files"
                                        <Tool
                                                Name="VCCustomBuildTool"
                                                Description="Uic&apos;ing $(InputFileName)..."
-                                               CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;"
+                                               CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
                                                AdditionalDependencies="$(QTDIR)\bin\uic.exe"
                                                Outputs="&quot;.\ui_$(InputName).h&quot;"
                                        />
index f69bb6e7975e8adaafe4ab144aff83992a34b067..f7501abe73b0b79a112480f29a55a0aa54f2a864 100644 (file)
@@ -2,7 +2,7 @@
 <VisualStudioUserFile
        ProjectType="Visual C++"
        Version="9.00"
-       ShowAllFiles="false"
+       ShowAllFiles="true"
        >
        <Configurations>
                <Configuration
index dcd47c35c81517b72d621f8b74de27a471d77885..adcecc443a1db21a5bd5d5a9266113966d6d7405 100644 (file)
@@ -26,6 +26,7 @@ MdiChild::MdiChild()
     preview=true;
     applyCairo=false;
     previewFrm=NULL;
+    settingsSet=false;
 }
 
 void MdiChild::newFile()
@@ -167,4 +168,8 @@ void MdiChild::loadPreview(QString fileName)
     previewFrm->show();
 
 }
+bool MdiChild::firstTime()
+{
+    return settingsSet;
+}
 
index 6674a22572149d1c5247d076c4f130dfe2d77217..7ae5405c9be0f886dc86de396761fbde7fd5ce80 100644 (file)
@@ -42,6 +42,8 @@ public:
     ImageViewer* previewFrm;
     CMainWindow* parentFrm;
     void loadPreview(QString fileName);
+    bool firstTime();
+    bool settingsSet;
 protected:
     void closeEvent(QCloseEvent *event);
 
index 2b29440a7a9111ca437dbde1f7159397a97a060e..ff05bb729dce9015390fbaaf73d666148bef6008 100644 (file)
    <property name="frameShadow">
     <enum>QFrame::Raised</enum>
    </property>
-   <widget class="QWidget" name="">
+   <widget class="QWidget" name="layoutWidget">
     <property name="geometry">
      <rect>
       <x>2</x>
       <y>0</y>
-      <width>391</width>
-      <height>61</height>
+      <width>436</width>
+      <height>62</height>
      </rect>
     </property>
     <layout class="QHBoxLayout" name="horizontalLayout_7">
        <item>
         <layout class="QHBoxLayout" name="horizontalLayout_9">
          <item>
-          <widget class="QPushButton" name="pbCancel">
+          <widget class="QPushButton" name="btnCancel">
            <property name="text">
             <string>Cancel</string>
            </property>
index 87986c4f27cb02ea0774a8078ab81135f1d67604..278b2b811eb2adb6d6034b996a882a0ae3d7be17 100644 (file)
@@ -1,7 +1,7 @@
 /********************************************************************************
 ** Form generated from reading UI file 'settings.ui'
 **
-** Created: Fri Feb 25 14:25:48 2011
+** Created: Tue Mar 1 14:00:08 2011
 **      by: Qt User Interface Compiler version 4.7.0
 **
 ** WARNING! All changes made in this file will be lost when recompiling UI file!
@@ -50,7 +50,7 @@ public:
     QLineEdit *leOutput;
     QPushButton *pbOut;
     QFrame *frame_2;
-    QWidget *widget;
+    QWidget *layoutWidget1;
     QHBoxLayout *horizontalLayout_7;
     QVBoxLayout *verticalLayout_2;
     QHBoxLayout *horizontalLayout_5;
@@ -68,7 +68,7 @@ public:
     QSpacerItem *verticalSpacer;
     QPushButton *pushButton_4;
     QFrame *frame_3;
-    QWidget *layoutWidget1;
+    QWidget *layoutWidget2;
     QVBoxLayout *verticalLayout_4;
     QTextEdit *teAttributes;
     QHBoxLayout *horizontalLayout_10;
@@ -78,7 +78,7 @@ public:
     QPushButton *pbSave;
     QSpacerItem *horizontalSpacer_3;
     QHBoxLayout *horizontalLayout_9;
-    QPushButton *pbCancel;
+    QPushButton *btnCancel;
     QPushButton *btnOK;
 
     void setupUi(QDialog *Dialog)
@@ -178,42 +178,42 @@ public:
         frame_2->setGeometry(QRect(0, 150, 401, 61));
         frame_2->setFrameShape(QFrame::StyledPanel);
         frame_2->setFrameShadow(QFrame::Raised);
-        widget = new QWidget(frame_2);
-        widget->setObjectName(QString::fromUtf8("widget"));
-        widget->setGeometry(QRect(2, 0, 391, 61));
-        horizontalLayout_7 = new QHBoxLayout(widget);
+        layoutWidget1 = new QWidget(frame_2);
+        layoutWidget1->setObjectName(QString::fromUtf8("layoutWidget1"));
+        layoutWidget1->setGeometry(QRect(2, 0, 436, 62));
+        horizontalLayout_7 = new QHBoxLayout(layoutWidget1);
         horizontalLayout_7->setObjectName(QString::fromUtf8("horizontalLayout_7"));
         horizontalLayout_7->setContentsMargins(0, 0, 0, 0);
         verticalLayout_2 = new QVBoxLayout();
         verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));
         horizontalLayout_5 = new QHBoxLayout();
         horizontalLayout_5->setObjectName(QString::fromUtf8("horizontalLayout_5"));
-        label_5 = new QLabel(widget);
+        label_5 = new QLabel(layoutWidget1);
         label_5->setObjectName(QString::fromUtf8("label_5"));
 
         horizontalLayout_5->addWidget(label_5);
 
-        cbScope = new QComboBox(widget);
+        cbScope = new QComboBox(layoutWidget1);
         cbScope->setObjectName(QString::fromUtf8("cbScope"));
 
         horizontalLayout_5->addWidget(cbScope);
 
-        label_6 = new QLabel(widget);
+        label_6 = new QLabel(layoutWidget1);
         label_6->setObjectName(QString::fromUtf8("label_6"));
 
         horizontalLayout_5->addWidget(label_6);
 
-        cbNameG = new QComboBox(widget);
+        cbNameG = new QComboBox(layoutWidget1);
         cbNameG->setObjectName(QString::fromUtf8("cbNameG"));
 
         horizontalLayout_5->addWidget(cbNameG);
 
-        cbNameN = new QComboBox(widget);
+        cbNameN = new QComboBox(layoutWidget1);
         cbNameN->setObjectName(QString::fromUtf8("cbNameN"));
 
         horizontalLayout_5->addWidget(cbNameN);
 
-        cbNameE = new QComboBox(widget);
+        cbNameE = new QComboBox(layoutWidget1);
         cbNameE->setObjectName(QString::fromUtf8("cbNameE"));
 
         horizontalLayout_5->addWidget(cbNameE);
@@ -223,14 +223,14 @@ public:
 
         horizontalLayout_6 = new QHBoxLayout();
         horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6"));
-        label_7 = new QLabel(widget);
+        label_7 = new QLabel(layoutWidget1);
         label_7->setObjectName(QString::fromUtf8("label_7"));
         label_7->setMinimumSize(QSize(40, 0));
         label_7->setMaximumSize(QSize(47, 16777215));
 
         horizontalLayout_6->addWidget(label_7);
 
-        leValue = new QLineEdit(widget);
+        leValue = new QLineEdit(layoutWidget1);
         leValue->setObjectName(QString::fromUtf8("leValue"));
 
         horizontalLayout_6->addWidget(leValue);
@@ -243,7 +243,7 @@ public:
 
         verticalLayout_3 = new QVBoxLayout();
         verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3"));
-        pbAdd = new QPushButton(widget);
+        pbAdd = new QPushButton(layoutWidget1);
         pbAdd->setObjectName(QString::fromUtf8("pbAdd"));
         pbAdd->setMinimumSize(QSize(75, 0));
 
@@ -253,7 +253,7 @@ public:
 
         verticalLayout_3->addItem(verticalSpacer);
 
-        pushButton_4 = new QPushButton(widget);
+        pushButton_4 = new QPushButton(layoutWidget1);
         pushButton_4->setObjectName(QString::fromUtf8("pushButton_4"));
         pushButton_4->setMinimumSize(QSize(75, 0));
 
@@ -267,13 +267,13 @@ public:
         frame_3->setGeometry(QRect(0, 210, 401, 301));
         frame_3->setFrameShape(QFrame::StyledPanel);
         frame_3->setFrameShadow(QFrame::Raised);
-        layoutWidget1 = new QWidget(frame_3);
-        layoutWidget1->setObjectName(QString::fromUtf8("layoutWidget1"));
-        layoutWidget1->setGeometry(QRect(7, 6, 391, 291));
-        verticalLayout_4 = new QVBoxLayout(layoutWidget1);
+        layoutWidget2 = new QWidget(frame_3);
+        layoutWidget2->setObjectName(QString::fromUtf8("layoutWidget2"));
+        layoutWidget2->setGeometry(QRect(7, 6, 391, 291));
+        verticalLayout_4 = new QVBoxLayout(layoutWidget2);
         verticalLayout_4->setObjectName(QString::fromUtf8("verticalLayout_4"));
         verticalLayout_4->setContentsMargins(0, 0, 0, 0);
-        teAttributes = new QTextEdit(layoutWidget1);
+        teAttributes = new QTextEdit(layoutWidget2);
         teAttributes->setObjectName(QString::fromUtf8("teAttributes"));
 
         verticalLayout_4->addWidget(teAttributes);
@@ -282,21 +282,21 @@ public:
         horizontalLayout_10->setObjectName(QString::fromUtf8("horizontalLayout_10"));
         horizontalLayout_8 = new QHBoxLayout();
         horizontalLayout_8->setObjectName(QString::fromUtf8("horizontalLayout_8"));
-        pbNew = new QPushButton(layoutWidget1);
+        pbNew = new QPushButton(layoutWidget2);
         pbNew->setObjectName(QString::fromUtf8("pbNew"));
         pbNew->setMinimumSize(QSize(40, 0));
         pbNew->setMaximumSize(QSize(40, 16777215));
 
         horizontalLayout_8->addWidget(pbNew);
 
-        pbOpen = new QPushButton(layoutWidget1);
+        pbOpen = new QPushButton(layoutWidget2);
         pbOpen->setObjectName(QString::fromUtf8("pbOpen"));
         pbOpen->setMinimumSize(QSize(40, 0));
         pbOpen->setMaximumSize(QSize(40, 16777215));
 
         horizontalLayout_8->addWidget(pbOpen);
 
-        pbSave = new QPushButton(layoutWidget1);
+        pbSave = new QPushButton(layoutWidget2);
         pbSave->setObjectName(QString::fromUtf8("pbSave"));
         pbSave->setMinimumSize(QSize(40, 0));
         pbSave->setMaximumSize(QSize(40, 16777215));
@@ -312,12 +312,12 @@ public:
 
         horizontalLayout_9 = new QHBoxLayout();
         horizontalLayout_9->setObjectName(QString::fromUtf8("horizontalLayout_9"));
-        pbCancel = new QPushButton(layoutWidget1);
-        pbCancel->setObjectName(QString::fromUtf8("pbCancel"));
+        btnCancel = new QPushButton(layoutWidget2);
+        btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
 
-        horizontalLayout_9->addWidget(pbCancel);
+        horizontalLayout_9->addWidget(btnCancel);
 
-        btnOK = new QPushButton(layoutWidget1);
+        btnOK = new QPushButton(layoutWidget2);
         btnOK->setObjectName(QString::fromUtf8("btnOK"));
 
         horizontalLayout_9->addWidget(btnOK);
@@ -377,7 +377,7 @@ public:
         pbNew->setText(QApplication::translate("Dialog", "clear", 0, QApplication::UnicodeUTF8));
         pbOpen->setText(QApplication::translate("Dialog", "load", 0, QApplication::UnicodeUTF8));
         pbSave->setText(QApplication::translate("Dialog", "save", 0, QApplication::UnicodeUTF8));
-        pbCancel->setText(QApplication::translate("Dialog", "Cancel", 0, QApplication::UnicodeUTF8));
+        btnCancel->setText(QApplication::translate("Dialog", "Cancel", 0, QApplication::UnicodeUTF8));
         btnOK->setText(QApplication::translate("Dialog", "OK", 0, QApplication::UnicodeUTF8));
     } // retranslateUi
 
index 4e41e76cb260e8d26182331448d089dd209db80e..0fae3a01bfe8b736434915880a2fa6bbf197ef5b 100644 (file)
Binary files a/cmd/gvedit/vc90.idb and b/cmd/gvedit/vc90.idb differ
index dfdb1d317972d21c7591ad396b75001636c301f1..ad033189877b0c229a847717d3d64f5ee8b54953 100644 (file)
Binary files a/cmd/gvedit/vc90.pdb and b/cmd/gvedit/vc90.pdb differ