diff -r 9771028de303 -r 9db3eaa21237 mainwindow.cpp --- a/mainwindow.cpp Mon Jan 31 09:47:43 2005 +0000 +++ b/mainwindow.cpp Tue Feb 08 14:07:19 2005 +0000 @@ -37,6 +37,8 @@ #include "icons/viewzoomreset.xpm" #include "icons/viewzoomin.xpm" #include "icons/viewzoomout.xpm" +#include "icons/modecolor.xpm" +#include "icons/modelink.xpm" #include "icons/vym-48x48.xpm" #include "icons/flag-note.xpm" #include "icons/flag-url.xpm" @@ -88,6 +90,7 @@ extern QAction *actionEditSelectLast; extern QAction *actionEditLoadImage; extern QAction *actionEditToggleFloatExport; +extern QAction *actionEditNoLink; extern QAction* actionFormatColor; extern QAction* actionFormatPickColor; @@ -97,6 +100,10 @@ extern QAction* actionFormatBackColor; extern QAction* actionFormatLinkColor; +extern QActionGroup* actionGroupModModes; +extern QAction* actionModModeColor; +extern QAction* actionModModeLink; + extern QActionGroup *actionGroupFormatFrameTypes; extern QAction *actionFormatFrameNone; extern QAction *actionFormatFrameRectangle; @@ -117,6 +124,7 @@ extern QAction* actionSettingsUseDelKey; extern QPopupMenu* branchContextMenu; +extern QPopupMenu* branchLinksContextMenu; extern QPopupMenu* floatimageContextMenu; extern QPopupMenu* saveImageFormatMenu; extern QPopupMenu* canvasContextMenu; @@ -189,6 +197,7 @@ setupEditActions(); setupFormatActions(); setupViewActions(); + setupModeActions(); setupFlagActions(); setupSettingsActions(); setupContextMenus(); @@ -476,7 +485,9 @@ actionEditHeading=a; a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" ); connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); - //a->addTo ( menu ); + actionEditHeading=a; + a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_F2, this, "editHeading" ); + connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); // Shortcut to delete selection a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" ); @@ -554,6 +565,11 @@ a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" ); connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) ); actionEditLoadImage=a; + + // inserted into branchLinksContextMenu, if no link is available. + a = new QAction( tr( "No link available" ),tr( "No link available" ), 0, this, "noLink" ); + a->setEnabled (false); + actionEditNoLink=a; } // Format Actions @@ -675,6 +691,29 @@ a->addTo( menu ); } +// Mode Actions +void Main::setupModeActions() +{ + //QPopupMenu *menu = new QPopupMenu( this ); + //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu ); + + QToolBar *tb = new QToolBar( this ); + tb->setLabel( "Modes (using modifiers)" ); + QAction *a; + actionGroupModModes=new QActionGroup ( this, "formatLinkStyles"); + actionGroupModModes->setExclusive (true); + a= new QAction( tr( "Use modifier to color branches" ), QPixmap(mode_color_xpm), tr( "Linkstyle Line" ), Key_C, actionGroupModModes, "modModeColor" ); + a->setToggleAction(true); + a->addTo (tb); + a->setOn(true); + actionModModeColor=a; + a= new QAction( tr( "Use modifier to draw links" ), QPixmap(mode_link_xpm), tr( "Linkstyle Line" ), Key_L, actionGroupModModes, "modModeLink" ); + + a->setToggleAction(true); + a->addTo (tb); + actionModModeLink=a; +} + // Flag Actions void Main::setupFlagActions() { @@ -799,6 +838,13 @@ branchContextMenu->insertSeparator(); actionGroupFormatFrameTypes->addTo( branchContextMenu ); + // Context Menu for links in a branch menu + // This will be populated "on demand" in MapEditor::updateActions + branchContextMenu->insertSeparator(); + branchLinksContextMenu =new QPopupMenu (this); + branchContextMenu->insertItem ("Goto Link",branchLinksContextMenu); + connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowLink(int ) ) ); + // Context menu for floatimage floatimageContextMenu =new QPopupMenu (this); saveImageFormatMenu=new QPopupMenu (this); @@ -1933,6 +1979,12 @@ currentMapEditor()->toggleFloatExport(); } +void Main::editFollowLink(int item) +{ + if (currentMapEditor()) + currentMapEditor()->followLink(branchLinksContextMenu->indexOf(item)); +} + void Main::formatSelectColor() { if (currentMapEditor()) @@ -2057,6 +2109,15 @@ currentMapEditor()->adjustCanvasSize(); } } + +void Main::modModeColor() +{ +} + +void Main::modModeLink() +{ +} + bool Main::settingsPDF() { // Default browser is set in constructor