[qet] [1932] Diagram editor: added the "zoom content" action.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 1932
Author:   xavier
Date:     2012-08-12 13:46:42 +0200 (Sun, 12 Aug 2012)
Log Message:
-----------
Diagram editor: added the "zoom content" action.

Modified Paths:
--------------
    trunk/qelectrotech.qrc
    trunk/sources/diagramview.cpp
    trunk/sources/diagramview.h
    trunk/sources/qetdiagrameditor.cpp
    trunk/sources/qetdiagrameditor.h
    trunk/sources/qeticons.cpp
    trunk/sources/qeticons.h

Added Paths:
-----------
    trunk/ico/16x16/zoom-fit-best.png
    trunk/ico/22x22/zoom-fit-best.png

Added: trunk/ico/16x16/zoom-fit-best.png
===================================================================
--- trunk/ico/16x16/zoom-fit-best.png	                        (rev 0)
+++ trunk/ico/16x16/zoom-fit-best.png	2012-08-12 11:46:42 UTC (rev 1932)
@@ -0,0 +1,8 @@
+\x89PNG
+
+
+IHDR\xF3\xFFasRGB\xAE\xCE\xE9bKGD\xFF\xFF\xFF\xA0\xBD\xA7\x93	pHYs\xEC\xECu85tIME\xD8
+*/\xB4\xAE\x9BIDATxڕ\x91=K\xC3P\x86ߛ\xA2\xD4*\t\xD1\xC5\xCD\xC9ݏY:UqT\xEA\xA4?E\x808):ĩ\xA0PA\xC5P;hM5I\xB5I\x93{<\xB9\xE6\xA2^\xB2\xF8\xC0\xC3M.\xBC''\xE7|3\xC6\xCE\xE1<\xB2oHY\xA6\x92d\xC0 %\xB9\xABV\xABxi\xB7!L
+XZ\\x84\x80HMl.\x97ӏ\xB0\xF0\x8B6\x87K\xA5\xD6\xD6\xD7\xF1\xF2\xFC˲`\xDB6l>Y~\xB7\xB1[\x91\xE8\xCD8\xA4\xF4B7O\x83x\xEFMG\xA2\xD9a\x9Dg\xB7\x9F\xF1Gv\x81\xB7]\xA9T\xE0\xB3S,L˴}\x8B\xB5Ip'\xC0\xE1\xC60Nv\xA0\xF9\xE2\xBB\xEB\x92\xEF\xFBtzP\xAFף (Ce\xBF\xDF\xD7\xEA!\xAE\xA8\xCC\xF6\xEBt\xA5\xFA\xDF=\xC0l\xCCB(\x9D2\xC3Ʃ1\xB6\xA0\xDCA\xC7O\x9F
+\xF5\xBA%\x9BفH;x\xED\xCA?\xA1V\xAB\x85F\xA3\x81|>\xAFeH\xE8t\xE9\xF7\x9D
+\x8BE$𐱷\xBF\xE0\xCA܂\x9A\xFAαG\xF9r\x876\x8F|\x8Ac\xC9\xC6T\xAB\xD5HJI\x9E\xE7Qy\xB7|`\xB3\x80ㅴz\xE0ѫ%!\xB5\xB6z\xBDN\xAE\xEB\xEA\xF04F\x81L\xC2(\xA6\xEB\xBB\xDA\xDA\xDE:\xCF\xFA\xB2\xDE\xC98;\xAF޳\x89\xD8K6\x80\xC1‡&&i\xE75qIEND\xAEB`\x82
\ No newline at end of file

Added: trunk/ico/22x22/zoom-fit-best.png
===================================================================
--- trunk/ico/22x22/zoom-fit-best.png	                        (rev 0)
+++ trunk/ico/22x22/zoom-fit-best.png	2012-08-12 11:46:42 UTC (rev 1932)
@@ -0,0 +1,8 @@
+\x89PNG
+
+
+IHDRĴl;sRGB\xAE\xCE\xE9bKGD\xFF\xFF\xFF\xA0\xBD\xA7\x93	pHYs	\x84	\x84\xAA\xE2cytIME\xD8
+\x97w\x8C1IDATxڵ\x94\xBFo\xD3P\xC7\xCFV X\x89\x90XE
+S\xB1\x90\x85F\x84b+\xCA\xC0\x82\xFFk\xF9\xFF\xE9F\x8B\xA5P3\xA4,H\xED€Z\xA9CZGrA\xC2vE\xFFH|\x9CO\xE9\xD5q\x93W\xE2\xA4\xCB\xF7|v>\xEF\xF9\xEB\xF7\xFC\xAF\xD0\xF5\xE5\xCD\xE4\xEDR\xC5E&Ѭ:\x8E\xB3\x9Eɜ\xB6\xF1\\xF2\x82\xAE\xEB\x90\xCF\xE7\x9F\xD0U3
+\x86\.\xA7\xB5\xB7\xB6\xE0Ȳ4\x8D_\xA7P(\xC0\xED\xF9y\xAE\xB9G)5\x9C\x86aR38=x\xB7ۅz\xBD\xCE\x9D\xB2\xD1h@\xB5Z\xE5\xEBi\xE0\xF6n\xF7\xAF\xE9\xF0\xD3\xF9\xB5\xC0\xE9x:|\xEE\\x84~\x80\xD0\xF3z\xA4\xFDX}\xE4l\xEFE`\@h\xBET\x83\xA8\xC7J\1\x94#\xE9k\xC0*\xCF~\xFC\xC1\xC3:\\xBE\xA4\xA9\xC1s\xE4釵\xB5x\xA6-\x95J\xC0\x83HN\x82\xDF\xD4໵h\xF0i?\x8F\xAEGbK2\xA1\xB0b\x84\x93^S\x9D\xB4\xEB\xAF\xC1\xE2\xEF \x8EAiM\xFFO
+f?\x8C\xA4)\xA8\xAE^\xC7\xDA	8\xE4\xDD$\x90PW/\xB7~\xCD\x89"\xA2\xE8\xB9V\x80Xqf0\xAEׁÃC\xDE\xC2\xD9lN\xCER~g\xEE\xBC\xF1\x8C\x915=\xE3\xAEiB\xA5R\x998\xA8\x8E\x8F]h\xB5Z.\xD5\xDF\xE5[\xCD\xFA\xBA\xC3Q\xBA'\x87\xCD\xE8\xFAƆ\xBB\xB4\xF4\xEA\xB5v`J,\x86a\x88\x9E\xE7\xE1\xE6\xD7\xD6^\xBB\xD8\xFC\xE2\xE1p8\xC4\xD1h\x84Q\xB1v:\xA9m\xFB'./\xBFuhw>\x97I\xAA\xC0\xBFh\xAD\xDD{\xE3\xA2\xD3\x93`\xAEM\xD3LB\xEDb\xB1\xF8L\xA0*\xB0\xEF\xFB\xFEpM3te\xE5\x9DM3\x8D\xA1\xE2\x93\xAC\xC0\xB2,\]}o\x97\xCB\xE5\xA7*h\xF2\xC6U\xCA;\xF0gaRnS"̈\xDFo\xA5G\xDD\xB9\xF0\xAFIEND\xAEB`\x82
\ No newline at end of file

Modified: trunk/qelectrotech.qrc
===================================================================
--- trunk/qelectrotech.qrc	2012-08-10 19:43:48 UTC (rev 1931)
+++ trunk/qelectrotech.qrc	2012-08-12 11:46:42 UTC (rev 1932)
@@ -79,6 +79,7 @@
 	<file>ico/16x16/west.png</file>
 	<file>ico/16x16/window-new.png</file>
 	<file>ico/16x16/zoom-draw.png</file>
+	<file>ico/16x16/zoom-fit-best.png</file>
 	<file>ico/16x16/zoom-in.png</file>
 	<file>ico/16x16/zoom-original.png</file>
 	<file>ico/16x16/zoom-out.png</file>
@@ -174,6 +175,7 @@
 	<file>ico/22x22/view-restore.png</file>
 	<file>ico/22x22/window-new.png</file>
 	<file>ico/22x22/zoom-draw.png</file>
+	<file>ico/22x22/zoom-fit-best.png</file>
 	<file>ico/22x22/zoom-in.png</file>
 	<file>ico/22x22/zoom-original.png</file>
 	<file>ico/22x22/zoom-out.png</file>

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2012-08-10 19:43:48 UTC (rev 1931)
+++ trunk/sources/diagramview.cpp	2012-08-12 11:46:42 UTC (rev 1932)
@@ -338,6 +338,14 @@
 }
 
 /**
+	Adjust zoom to fit all elements in the view, regardless of diagram borders.
+*/
+void DiagramView::zoomContent() {
+	fitInView(scene -> itemsBoundingRect(), Qt::KeepAspectRatio);
+	adjustGridToZoom();
+}
+
+/**
 	Reinitialise le zoom
 */
 void DiagramView::zoomReset() {

Modified: trunk/sources/diagramview.h
===================================================================
--- trunk/sources/diagramview.h	2012-08-10 19:43:48 UTC (rev 1931)
+++ trunk/sources/diagramview.h	2012-08-12 11:46:42 UTC (rev 1932)
@@ -127,6 +127,7 @@
 	void zoomIn();
 	void zoomOut();
 	void zoomFit();
+	void zoomContent();
 	void zoomReset();
 	void cut();
 	void copy();

Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp	2012-08-10 19:43:48 UTC (rev 1931)
+++ trunk/sources/qetdiagrameditor.cpp	2012-08-12 11:46:42 UTC (rev 1932)
@@ -216,6 +216,7 @@
 	
 	zoom_in           = new QAction(QET::Icons::ZoomIn,                tr("Zoom avant"),                           this);
 	zoom_out          = new QAction(QET::Icons::ZoomOut,               tr("Zoom arri\350re"),                      this);
+	zoom_content      = new QAction(QET::Icons::ZoomDraw,              tr("Zoom sur le contenu"),                  this);
 	zoom_fit          = new QAction(QET::Icons::ZoomFitBest,           tr("Zoom adapt\351"),                       this);
 	zoom_reset        = new QAction(QET::Icons::ZoomOriginal,          tr("Pas de zoom"),                          this);
 	
@@ -264,6 +265,7 @@
 	
 	zoom_in           -> setShortcut(QKeySequence::ZoomIn);
 	zoom_out          -> setShortcut(QKeySequence::ZoomOut);
+	zoom_content      -> setShortcut(QKeySequence(tr("Ctrl+8")));
 	zoom_fit          -> setShortcut(QKeySequence(tr("Ctrl+9")));
 	zoom_reset        -> setShortcut(QKeySequence(tr("Ctrl+0")));
 	
@@ -303,6 +305,7 @@
 	
 	zoom_in           -> setStatusTip(tr("Agrandit le sch\351ma", "status bar tip"));
 	zoom_out          -> setStatusTip(tr("R\351tr\351cit le sch\351ma", "status bar tip"));
+	zoom_content      -> setStatusTip(tr("Adapte le zoom de fa\347on \340 afficher tout le contenu ind\351pendamment du cadre"));
 	zoom_fit          -> setStatusTip(tr("Adapte la taille du sch\351ma afin qu'il soit enti\350rement visible", "status bar tip"));
 	zoom_reset        -> setStatusTip(tr("Restaure le zoom par d\351faut", "status bar tip"));
 	
@@ -353,6 +356,7 @@
 	connect(prj_clean,          SIGNAL(triggered()), this,       SLOT(cleanCurrentProject())       );
 	connect(zoom_in,            SIGNAL(triggered()), this,       SLOT(slot_zoomIn())               );
 	connect(zoom_out,           SIGNAL(triggered()), this,       SLOT(slot_zoomOut())              );
+	connect(zoom_content,       SIGNAL(triggered()), this,       SLOT(slot_zoomContent())          );
 	connect(zoom_fit,           SIGNAL(triggered()), this,       SLOT(slot_zoomFit())              );
 	connect(zoom_reset,         SIGNAL(triggered()), this,       SLOT(slot_zoomReset())            );
 	connect(print,              SIGNAL(triggered()), this,       SLOT(printDialog())               );
@@ -482,6 +486,7 @@
 	menu_affichage -> addSeparator();
 	menu_affichage -> addAction(zoom_in);
 	menu_affichage -> addAction(zoom_out);
+	menu_affichage -> addAction(zoom_content);
 	menu_affichage -> addAction(zoom_fit);
 	menu_affichage -> addAction(zoom_reset);
 	
@@ -527,6 +532,7 @@
 	view_bar -> addSeparator();
 	view_bar -> addAction(zoom_in);
 	view_bar -> addAction(zoom_out);
+	view_bar -> addAction(zoom_content);
 	view_bar -> addAction(zoom_fit);
 	view_bar -> addAction(zoom_reset);
 	
@@ -969,6 +975,13 @@
 }
 
 /**
+	Call the "zoom content" action for the current diagram.
+*/
+void QETDiagramEditor::slot_zoomContent() {
+	if(currentDiagram()) currentDiagram() -> zoomContent();
+}
+
+/**
 	Effectue l'action "zoom par defaut" sur le schema en cours
 */
 void QETDiagramEditor::slot_zoomReset() {
@@ -1059,6 +1072,7 @@
 	select_invert     -> setEnabled(opened_diagram);
 	zoom_in           -> setEnabled(opened_diagram);
 	zoom_out          -> setEnabled(opened_diagram);
+	zoom_content      -> setEnabled(opened_diagram);
 	zoom_fit          -> setEnabled(opened_diagram);
 	zoom_reset        -> setEnabled(opened_diagram);
 	infos_diagram     -> setEnabled(opened_diagram);

Modified: trunk/sources/qetdiagrameditor.h
===================================================================
--- trunk/sources/qetdiagrameditor.h	2012-08-10 19:43:48 UTC (rev 1931)
+++ trunk/sources/qetdiagrameditor.h	2012-08-12 11:46:42 UTC (rev 1932)
@@ -99,6 +99,7 @@
 	void slot_zoomIn();
 	void slot_zoomOut();
 	void slot_zoomFit();
+	void slot_zoomContent();
 	void slot_zoomReset();
 	void slot_selectAll();
 	void slot_selectNothing();
@@ -196,7 +197,8 @@
 	QAction *prj_clean;          ///< Nettoie un projet
 	QAction *zoom_in;            ///< Zoome avant
 	QAction *zoom_out;           ///< Zoome arriere
-	QAction *zoom_fit;           ///< Ajuste le zoom de facon a voir l'integralite des elements
+	QAction *zoom_fit;           ///< Adjust zoom to fit the whole diagram, including potential elements outside its borders, in the view
+	QAction *zoom_content;       ///< Adjust zoom to fit all elements in the view, regardless of diagram borders
 	QAction *zoom_reset;         ///< Remet le zoom 1:1
 	QAction *tile_window;        ///< Affiche les fenetre MDI en mosaique
 	QAction *cascade_window;     ///< Affiche les fenetres MDI en cascade

Modified: trunk/sources/qeticons.cpp
===================================================================
--- trunk/sources/qeticons.cpp	2012-08-10 19:43:48 UTC (rev 1931)
+++ trunk/sources/qeticons.cpp	2012-08-12 11:46:42 UTC (rev 1932)
@@ -146,6 +146,7 @@
 		QIcon West;
 		QIcon WindowNew;
 		QIcon XmlTextFile;
+		QIcon ZoomDraw;
 		QIcon ZoomFitBest;
 		QIcon ZoomIn;
 		QIcon ZoomOriginal;
@@ -372,8 +373,10 @@
 	XmlTextFile         .addFile(":/ico/16x16/text-xml.png");
 	XmlTextFile         .addFile(":/ico/22x22/text-xml.png");
 	XmlTextFile         .addFile(":/ico/32x32/text-xml.png");
-	ZoomFitBest         .addFile(":/ico/16x16/zoom-draw.png");
-	ZoomFitBest         .addFile(":/ico/22x22/zoom-draw.png");
+	ZoomDraw            .addFile(":/ico/16x16/zoom-draw.png");
+	ZoomDraw            .addFile(":/ico/22x22/zoom-draw.png");
+	ZoomFitBest         .addFile(":/ico/16x16/zoom-fit-best.png");
+	ZoomFitBest         .addFile(":/ico/22x22/zoom-fit-best.png");
 	ZoomIn              .addFile(":/ico/16x16/zoom-in.png");
 	ZoomIn              .addFile(":/ico/22x22/zoom-in.png");
 	ZoomOriginal        .addFile(":/ico/16x16/zoom-original.png");

Modified: trunk/sources/qeticons.h
===================================================================
--- trunk/sources/qeticons.h	2012-08-10 19:43:48 UTC (rev 1931)
+++ trunk/sources/qeticons.h	2012-08-12 11:46:42 UTC (rev 1932)
@@ -155,6 +155,7 @@
 		extern QIcon West;
 		extern QIcon WindowNew;
 		extern QIcon XmlTextFile;
+		extern QIcon ZoomDraw;
 		extern QIcon ZoomFitBest;
 		extern QIcon ZoomIn;
 		extern QIcon ZoomOriginal;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/