Use CTRL-Click to open URL in a tab (instead of ALT)
authorinsilmaril
Wed Mar 29 09:11:09 2006 +0000 (2006-03-29)
changeset 2675d0cbeb02bf3
parent 266 7d91b35c1b6f
child 268 2a6157d381fe
Use CTRL-Click to open URL in a tab (instead of ALT)
mainwindow.cpp
mapeditor.cpp
mapeditor.h
tex/vym.tex
     1.1 --- a/mainwindow.cpp	Tue Mar 28 20:04:04 2006 +0000
     1.2 +++ b/mainwindow.cpp	Wed Mar 29 09:11:09 2006 +0000
     1.3 @@ -522,7 +522,7 @@
     1.4  	a->setEnabled (false);
     1.5  	actionEditOpenURL=a;
     1.6  
     1.7 -	a = new QAction( tr( "Open URL in new tab" ), QPixmap(), tr( "Open URL in new tab" ), ALT + Key_U, this, "urltab" );
     1.8 +	a = new QAction( tr( "Open URL in new tab" ), QPixmap(), tr( "Open URL in new tab" ), CTRL + Key_U, this, "urltab" );
     1.9      connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) );
    1.10  	a->setEnabled (false);
    1.11  	actionEditOpenURLTab=a;
     2.1 --- a/mapeditor.cpp	Tue Mar 28 20:04:04 2006 +0000
     2.2 +++ b/mapeditor.cpp	Wed Mar 29 09:11:09 2006 +0000
     2.3 @@ -1658,6 +1658,26 @@
     2.4  	return selection;
     2.5  }
     2.6  
     2.7 +void MapEditor::unselect()
     2.8 +{
     2.9 +	if (selection) 
    2.10 +	{
    2.11 +		selectionLast=selection;
    2.12 +		selection->unselect();
    2.13 +		selection=NULL;
    2.14 +	}
    2.15 +}	
    2.16 +
    2.17 +void MapEditor::reselect()
    2.18 +{
    2.19 +	if (selectionLast)
    2.20 +	{
    2.21 +		selection=selectionLast;
    2.22 +		selection->select();
    2.23 +		selectionLast=NULL;
    2.24 +	}
    2.25 +}	
    2.26 +
    2.27  bool MapEditor::select (const QString &s)
    2.28  {
    2.29  	LinkableMapObj *lmo=mapCenter->findObjBySelect(s);
    2.30 @@ -1675,25 +1695,19 @@
    2.31  	return false;
    2.32  }
    2.33  
    2.34 -void MapEditor::unselect()
    2.35 +void MapEditor::select (LinkableMapObj *lmo)
    2.36  {
    2.37 -	if (selection) 
    2.38 +	if (lmo && selection != lmo)
    2.39  	{
    2.40 -		selectionLast=selection;
    2.41 -		selection->unselect();
    2.42 -		selection=NULL;
    2.43 +		// select the MapObj
    2.44 +		if (selection) selection->unselect();
    2.45 +		selection=lmo;
    2.46 +		selection->select();
    2.47 +			
    2.48 +		adjustCanvasSize();
    2.49  	}
    2.50 -}	
    2.51 -
    2.52 -void MapEditor::reselect()
    2.53 -{
    2.54 -	if (selectionLast)
    2.55 -	{
    2.56 -		selection=selectionLast;
    2.57 -		selection->select();
    2.58 -		selectionLast=NULL;
    2.59 -	}
    2.60 -}	
    2.61 +
    2.62 +}
    2.63  
    2.64  void MapEditor::selectNextBranch()
    2.65  {
    2.66 @@ -3106,17 +3120,45 @@
    2.67      QPoint p = inverseWorldMatrix().map(e->pos());
    2.68      LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
    2.69  	
    2.70 +	//Take care of clickdesystem flags _or_ modifier modes
    2.71 +	//
    2.72 +	if (lmo && (typeid(*lmo)==typeid(BranchObj) ||
    2.73 +		typeid(*lmo)==typeid(MapCenterObj) ))
    2.74 +	{
    2.75 +		QString foname=((BranchObj*)lmo)->getSystemFlagName(p);
    2.76 +		if (!foname.isEmpty())
    2.77 +		{
    2.78 +			// systemFlag clicked
    2.79 +			select (lmo);
    2.80 +			if (foname=="url") 
    2.81 +			{
    2.82 +				if (e->state() & QMouseEvent::ControlButton)
    2.83 +					mainWindow->editOpenURLTab();
    2.84 +				else	
    2.85 +					mainWindow->editOpenURL();
    2.86 +			}	
    2.87 +			else if (foname=="vymLink")
    2.88 +			{
    2.89 +				mainWindow->editOpenVymLink();
    2.90 +				// tabWidget may change, better return now
    2.91 +				// before segfaulting...
    2.92 +			} else if (foname=="note")
    2.93 +				mainWindow->windowToggleNoteEditor();
    2.94 +			else if (foname=="hideInExport")		
    2.95 +				toggleHideExport();
    2.96 +			return;	
    2.97 +		} 
    2.98 +	} 
    2.99 +	// No system flag clicked, take care of modmodes
   2.100 +
   2.101  	// Special case: CTRL is pressed
   2.102  	if (e->state() & QMouseEvent::ControlButton)
   2.103  	{
   2.104  		if (actionModModeColor->isOn())
   2.105  		{
   2.106 -			if (e->state() & QMouseEvent::ControlButton)
   2.107 -			{
   2.108  				pickingColor=true;
   2.109  				setCursor (pickColorCursor);
   2.110  				return;
   2.111 -			}
   2.112  		} 
   2.113  		if (actionModModeLink->isOn())
   2.114  		{	
   2.115 @@ -3141,49 +3183,11 @@
   2.116  				tmpXLink->setVisibility (true);
   2.117  				return;
   2.118  			} 
   2.119 -		}	
   2.120 +		}
   2.121  	}
   2.122 -
   2.123      if (lmo) 
   2.124 -	{	// MapObj was found
   2.125 -		if (selection != lmo)
   2.126 -		{
   2.127 -			// select the MapObj
   2.128 -			if (selection) selection->unselect();
   2.129 -			selection=lmo;
   2.130 -			selection->select();
   2.131 -				
   2.132 -			adjustCanvasSize();
   2.133 -		}
   2.134 -
   2.135 -		// Check, if systemFlag clicked
   2.136 -		if (typeid(*selection)==typeid(BranchObj) ||
   2.137 -			typeid(*selection)==typeid(MapCenterObj) )
   2.138 -		{
   2.139 -			QString foname=((BranchObj*)selection)->getSystemFlagName(p);
   2.140 -			if (!foname.isEmpty())
   2.141 -			{
   2.142 -				// Do not move, if systemFlag clicked
   2.143 -				if (foname=="url") 
   2.144 -				{
   2.145 -					if (e->state() & QMouseEvent::ControlButton)
   2.146 -						mainWindow->editOpenURLTab();
   2.147 -					else	
   2.148 -						mainWindow->editOpenURL();
   2.149 -				}	
   2.150 -				else if (foname=="vymLink")
   2.151 -				{
   2.152 -					mainWindow->editOpenVymLink();
   2.153 -					// tabWidget may change, better return now
   2.154 -					// before segfaulting...
   2.155 -					return;
   2.156 -				} else if (foname=="note")
   2.157 -					mainWindow->windowToggleNoteEditor();
   2.158 -				else if (foname=="hideInExport")		
   2.159 -					toggleHideExport();
   2.160 -			}			
   2.161 -		}	
   2.162 -			
   2.163 +	{	
   2.164 +		select (lmo);
   2.165  		// Left Button	    Move Branches
   2.166  		if (e->button() == QMouseEvent::LeftButton )
   2.167  		{
     3.1 --- a/mapeditor.h	Tue Mar 28 20:04:04 2006 +0000
     3.2 +++ b/mapeditor.h	Wed Mar 29 09:11:09 2006 +0000
     3.3 @@ -99,10 +99,11 @@
     3.4      void addNewBranchHere();		// insert and make selection its
     3.5      void deleteSelection();
     3.6  	LinkableMapObj* getSelection();	// returns selection
     3.7 -	bool select(const QString &);	// Select 
     3.8  	void unselect();				// before changing current noteedit
     3.9  	void reselect();				// after  changing current noteedit
    3.10 +	bool select(const QString &);	// Select 
    3.11  private:	
    3.12 +	void select(LinkableMapObj*);	
    3.13  	void selectNextBranch();		// Increment number of branch
    3.14  	void selectPrevBranch();		// Decrement number of branch
    3.15  public:	
     4.1 --- a/tex/vym.tex	Tue Mar 28 20:04:04 2006 +0000
     4.2 +++ b/tex/vym.tex	Wed Mar 29 09:11:09 2006 +0000
     4.3 @@ -509,7 +509,7 @@
     4.4  	\includegraphics[width=0.5cm]{flag-url.png}
     4.5  \end{center}
     4.6  If you use konqueror as browser, \vym will remember the konqueror which
     4.7 -was opened first by \vym. You can also press \key{Alt} and click to
     4.8 +was opened first by \vym. You can also press \key{Ctrl} and click to
     4.9  open the link in a new tab then.
    4.10  
    4.11  If you want to keep bookmarks in a map, select a branch where you want