mainwindow.cpp
changeset 89 9db3eaa21237
parent 0 7a96bd401351
child 90 10f3d35dcbad
     1.1 --- a/mainwindow.cpp	Mon Jan 31 09:47:43 2005 +0000
     1.2 +++ b/mainwindow.cpp	Tue Feb 08 14:07:19 2005 +0000
     1.3 @@ -37,6 +37,8 @@
     1.4  #include "icons/viewzoomreset.xpm"
     1.5  #include "icons/viewzoomin.xpm"
     1.6  #include "icons/viewzoomout.xpm"
     1.7 +#include "icons/modecolor.xpm"
     1.8 +#include "icons/modelink.xpm"
     1.9  #include "icons/vym-48x48.xpm"
    1.10  #include "icons/flag-note.xpm"
    1.11  #include "icons/flag-url.xpm"
    1.12 @@ -88,6 +90,7 @@
    1.13  extern QAction *actionEditSelectLast;
    1.14  extern QAction *actionEditLoadImage;
    1.15  extern QAction *actionEditToggleFloatExport;
    1.16 +extern QAction *actionEditNoLink;
    1.17  
    1.18  extern QAction* actionFormatColor;
    1.19  extern QAction* actionFormatPickColor;
    1.20 @@ -97,6 +100,10 @@
    1.21  extern QAction* actionFormatBackColor;
    1.22  extern QAction* actionFormatLinkColor;
    1.23  
    1.24 +extern QActionGroup* actionGroupModModes;
    1.25 +extern QAction* actionModModeColor;
    1.26 +extern QAction* actionModModeLink;
    1.27 +
    1.28  extern QActionGroup *actionGroupFormatFrameTypes;
    1.29  extern QAction *actionFormatFrameNone;
    1.30  extern QAction *actionFormatFrameRectangle;
    1.31 @@ -117,6 +124,7 @@
    1.32  extern QAction* actionSettingsUseDelKey;
    1.33  
    1.34  extern QPopupMenu* branchContextMenu;
    1.35 +extern QPopupMenu* branchLinksContextMenu;
    1.36  extern QPopupMenu* floatimageContextMenu;
    1.37  extern QPopupMenu* saveImageFormatMenu;
    1.38  extern QPopupMenu* canvasContextMenu;
    1.39 @@ -189,6 +197,7 @@
    1.40      setupEditActions();
    1.41      setupFormatActions();
    1.42      setupViewActions();
    1.43 +    setupModeActions();
    1.44  	setupFlagActions();
    1.45      setupSettingsActions();
    1.46  	setupContextMenus();
    1.47 @@ -476,7 +485,9 @@
    1.48  	actionEditHeading=a;
    1.49      a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
    1.50      connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
    1.51 -    //a->addTo ( menu );
    1.52 +	actionEditHeading=a;
    1.53 +    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_F2, this, "editHeading" );
    1.54 +    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
    1.55      
    1.56      // Shortcut to delete selection
    1.57      a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
    1.58 @@ -554,6 +565,11 @@
    1.59      a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
    1.60      connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
    1.61  	actionEditLoadImage=a;
    1.62 +
    1.63 +	// inserted into branchLinksContextMenu, if no link is available.
    1.64 +    a = new QAction( tr( "No link available" ),tr( "No link available" ), 0, this, "noLink" );
    1.65 +	a->setEnabled (false);
    1.66 +	actionEditNoLink=a;
    1.67  }
    1.68  
    1.69  // Format Actions
    1.70 @@ -675,6 +691,29 @@
    1.71      a->addTo( menu );
    1.72  }
    1.73  
    1.74 +// Mode Actions
    1.75 +void Main::setupModeActions()
    1.76 +{
    1.77 +    //QPopupMenu *menu = new QPopupMenu( this );
    1.78 +    //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
    1.79 +
    1.80 +    QToolBar *tb = new QToolBar( this );
    1.81 +    tb->setLabel( "Modes (using modifiers)" );
    1.82 +    QAction *a;
    1.83 +	actionGroupModModes=new QActionGroup ( this, "formatLinkStyles");
    1.84 +	actionGroupModModes->setExclusive (true);
    1.85 +    a= new QAction( tr( "Use modifier to color branches" ), QPixmap(mode_color_xpm), tr( "Linkstyle Line" ), Key_C, actionGroupModModes, "modModeColor" );
    1.86 +	a->setToggleAction(true);
    1.87 +	a->addTo (tb);
    1.88 +	a->setOn(true);
    1.89 +	actionModModeColor=a;
    1.90 +    a= new QAction( tr( "Use modifier to draw links" ), QPixmap(mode_link_xpm), tr( "Linkstyle Line" ), Key_L, actionGroupModModes, "modModeLink" );
    1.91 +
    1.92 +	a->setToggleAction(true);
    1.93 +	a->addTo (tb);
    1.94 +	actionModModeLink=a;
    1.95 +}
    1.96 +
    1.97  // Flag Actions
    1.98  void Main::setupFlagActions()
    1.99  {
   1.100 @@ -799,6 +838,13 @@
   1.101  	branchContextMenu->insertSeparator();	
   1.102  	actionGroupFormatFrameTypes->addTo( branchContextMenu );
   1.103  
   1.104 +	// Context Menu for links in a branch menu
   1.105 +	// This will be populated "on demand" in MapEditor::updateActions
   1.106 +	branchContextMenu->insertSeparator();	
   1.107 +	branchLinksContextMenu =new QPopupMenu (this);
   1.108 +	branchContextMenu->insertItem ("Goto Link",branchLinksContextMenu);
   1.109 +	connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowLink(int ) ) );
   1.110 +
   1.111  	// Context menu for floatimage
   1.112  	floatimageContextMenu =new QPopupMenu (this);
   1.113  	saveImageFormatMenu=new QPopupMenu (this);
   1.114 @@ -1933,6 +1979,12 @@
   1.115  		currentMapEditor()->toggleFloatExport();
   1.116  }
   1.117  
   1.118 +void Main::editFollowLink(int item)
   1.119 +{
   1.120 +	if (currentMapEditor())
   1.121 +		currentMapEditor()->followLink(branchLinksContextMenu->indexOf(item));
   1.122 +}
   1.123 +
   1.124  void Main::formatSelectColor()
   1.125  {
   1.126  	if (currentMapEditor())
   1.127 @@ -2057,6 +2109,15 @@
   1.128  		currentMapEditor()->adjustCanvasSize();
   1.129  	}	
   1.130  }
   1.131 +
   1.132 +void Main::modModeColor()
   1.133 +{
   1.134 +}
   1.135 +
   1.136 +void Main::modModeLink()
   1.137 +{
   1.138 +}
   1.139 +
   1.140  bool Main::settingsPDF()
   1.141  {
   1.142  	// Default browser is set in constructor