mainwindow.cpp
changeset 160 72cc3873306a
parent 159 e44baadd4958
child 163 30b22f7bd009
     1.1 --- a/mainwindow.cpp	Thu Sep 01 15:35:18 2005 +0000
     1.2 +++ b/mainwindow.cpp	Mon Sep 05 11:56:31 2005 +0000
     1.3 @@ -121,6 +121,7 @@
     1.4  extern QAction *actionFormatLinkStyleParabel;
     1.5  extern QAction *actionFormatLinkStylePolyLine;
     1.6  extern QAction *actionFormatLinkStylePolyParabel;
     1.7 +extern QAction *actionFormatHideLinkUnselected;
     1.8  
     1.9  extern QAction *actionViewToggleNoteEditor;
    1.10  
    1.11 @@ -234,6 +235,10 @@
    1.12  	connect (findWindow, SIGNAL( somethingChanged() ), 
    1.13  		this, SLOT(editFindChanged() ) );	
    1.14  
    1.15 +	// FIXME testing
    1.16 +	// Connect TextEditor, so that we can update flags if text changes
    1.17 +	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
    1.18 +
    1.19  	updateGeometry();
    1.20  
    1.21  	// Creating  the default map into first tab is done in main.cpp now...
    1.22 @@ -453,21 +458,18 @@
    1.23  
    1.24  	a = new QAction( tr( "Open URL" ), QPixmap(flag_url_xpm), tr( "Open URL" ), CTRL + Key_U, this, "url" );
    1.25      connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
    1.26 -    a->addTo( menu );
    1.27      a->addTo( tb );
    1.28  	a->setEnabled (false);
    1.29  	actionEditOpenURL=a;
    1.30  
    1.31  	a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL"+QString("...") ), SHIFT + CTRL + Key_U, this, "url" );
    1.32      connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
    1.33 -    a->addTo( menu );
    1.34  	a->setEnabled (false);
    1.35  	actionListBranches.append(a);
    1.36  	actionEditURL=a;
    1.37  	
    1.38  	a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
    1.39      connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
    1.40 -    a->addTo( menu );
    1.41  	a->setEnabled (false);
    1.42  	actionListBranches.append(a);
    1.43  	actionEditHeading2URL=a;
    1.44 @@ -478,33 +480,26 @@
    1.45  	actionListBranches.append(a);
    1.46  	actionEditBugzilla2URL=a;
    1.47      
    1.48 -	menu->insertSeparator();
    1.49  	
    1.50      a = new QAction( tr( "Jump to another vym map, if needed load it first" ), QPixmap(flag_vymlink_xpm), tr( "Jump to map" ), 0, this, "jumpMap" );
    1.51      connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
    1.52 -    a->addTo( menu );
    1.53      a->addTo( tb );
    1.54  	a->setEnabled (false);
    1.55  	actionEditOpenVymLink=a;
    1.56  	
    1.57      a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link"+QString("...") ), 0, this, "editLinkMap" );
    1.58      connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
    1.59 -    a->addTo( menu );
    1.60  	a->setEnabled (false);
    1.61  	actionListBranches.append(a);
    1.62  	actionEditVymLink=a;
    1.63  
    1.64      a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
    1.65      connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) );
    1.66 -    a->addTo( menu );
    1.67  	a->setEnabled (false);
    1.68  	actionEditDeleteVymLink=a;
    1.69  
    1.70 -	menu->insertSeparator();
    1.71 -
    1.72      a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info"+QString("...") ), 0, this, "editMapInfo" );
    1.73      connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
    1.74 -    a->addTo( menu );
    1.75  	a->setEnabled (true);
    1.76  	actionEditMapInfo=a;
    1.77  
    1.78 @@ -521,7 +516,6 @@
    1.79      a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_F2, this, "editHeading" );
    1.80      connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
    1.81  	a->setEnabled (false);
    1.82 -    a->addTo ( menu );
    1.83  	actionEditHeading=a;
    1.84  	actionListBranches.append(a);
    1.85      
    1.86 @@ -529,7 +523,6 @@
    1.87      a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
    1.88      connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) );
    1.89  	a->setEnabled (false);
    1.90 -    a->addTo ( menu );
    1.91  	actionEditDelete=a;
    1.92      
    1.93      // Shortcut to add branch
    1.94 @@ -697,6 +690,11 @@
    1.95      connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
    1.96  	actionFormatFrameRectangle=a;
    1.97  
    1.98 +    a = new QAction( tr( "Hide link" ),tr( "Hide link if object is not selected" ), 0, actionFormatHideLinkUnselected, "hideLinkUnselected" );
    1.99 +	a->setToggleAction(true);
   1.100 +    connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) );
   1.101 +	actionFormatHideLinkUnselected=a;
   1.102 +
   1.103      menu->insertSeparator();
   1.104      a= new QAction( tr( "Use same color for links and headings" ), QPixmap(), tr( "&Use color of heading for link" ), 0, this, "formatLinkColorHint" );
   1.105  	a->setToggleAction(true);
   1.106 @@ -924,6 +922,9 @@
   1.107  	branchContextMenu->insertSeparator();	
   1.108  	actionGroupFormatFrameTypes->addTo( branchContextMenu );
   1.109  
   1.110 +	branchContextMenu->insertSeparator();	
   1.111 +	actionFormatHideLinkUnselected->addTo( branchContextMenu );
   1.112 +
   1.113  	// Context Menu for links in a branch menu
   1.114  	// This will be populated "on demand" in MapEditor::updateActions
   1.115  	branchContextMenu->insertSeparator();	
   1.116 @@ -961,7 +962,8 @@
   1.117      a->addTo( floatimageContextMenu);
   1.118  	actionEditToggleFloatExport=a;
   1.119  
   1.120 -
   1.121 +	floatimageContextMenu->insertSeparator();	
   1.122 +	actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
   1.123  
   1.124  	// Context menu for exports
   1.125  	exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
   1.126 @@ -2195,6 +2197,12 @@
   1.127  		currentMapEditor()->setFrame(Rectangle);
   1.128  }
   1.129  
   1.130 +void Main::formatHideLinkUnselected()
   1.131 +{
   1.132 +	if (currentMapEditor())
   1.133 +		currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
   1.134 +}
   1.135 +
   1.136  void Main::viewZoomReset()
   1.137  {
   1.138  	if (currentMapEditor())
   1.139 @@ -2273,6 +2281,12 @@
   1.140  		windowShowNoteEditor();
   1.141  }
   1.142  
   1.143 +void Main::updateNoteFlag()
   1.144 +{
   1.145 +	if (currentMapEditor())
   1.146 +		currentMapEditor()->updateNoteFlag();
   1.147 +}
   1.148 +
   1.149  void Main::windowShowNoteEditor()
   1.150  {
   1.151  	textEditor->setShowWithMain(true);