[qet] [3799] Add new action DiagramMoveUpTop

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


Revision: 3799
Author:   scorpio810
Date:     2015-03-04 07:00:25 +0100 (Wed, 04 Mar 2015)
Log Message:
-----------
Add new action DiagramMoveUpTop

Modified Paths:
--------------
    trunk/sources/elementspanelwidget.cpp
    trunk/sources/elementspanelwidget.h
    trunk/sources/projectview.cpp
    trunk/sources/projectview.h
    trunk/sources/qetdiagrameditor.cpp
    trunk/sources/qetdiagrameditor.h

Modified: trunk/sources/elementspanelwidget.cpp
===================================================================
--- trunk/sources/elementspanelwidget.cpp	2015-03-03 20:53:13 UTC (rev 3798)
+++ trunk/sources/elementspanelwidget.cpp	2015-03-04 06:00:25 UTC (rev 3799)
@@ -73,6 +73,7 @@
 	prj_move_diagram_up   = new QAction(QET::Icons::GoUp,                      tr("Remonter ce schéma"),               this);
 	prj_move_diagram_down = new QAction(QET::Icons::GoDown,                    tr("Abaisser ce schéma"),               this);
 	prj_move_diagram_upx10   = new QAction(QET::Icons::GoUp,                   tr("Remonter ce schéma x10"),           this);
+	prj_move_diagram_top   = new QAction(QET::Icons::GoUp,                     tr("Remonter ce schéma au debut"),               this);
 	prj_move_diagram_downx10 = new QAction(QET::Icons::GoDown,                 tr("Abaisser ce schéma x10"),           this);
 	tbt_add               = new QAction(QET::Icons::TitleBlock,                tr("Nouveau modèle"),                   this);
 	tbt_edit              = new QAction(QET::Icons::TitleBlock,                tr("Éditer ce modèle"),              this);
@@ -121,6 +122,7 @@
 	connect(prj_del_diagram,       SIGNAL(triggered()), this,           SLOT(deleteDiagram()));
 	connect(prj_move_diagram_up,   SIGNAL(triggered()), this,           SLOT(moveDiagramUp()));
 	connect(prj_move_diagram_down, SIGNAL(triggered()), this,           SLOT(moveDiagramDown()));
+	connect(prj_move_diagram_top,  SIGNAL(triggered()), this,           SLOT(moveDiagramUpTop()));
 	connect(prj_move_diagram_upx10,   SIGNAL(triggered()), this,        SLOT(moveDiagramUpx10()));
 	connect(prj_move_diagram_downx10, SIGNAL(triggered()), this,        SLOT(moveDiagramDownx10()));
 	connect(tbt_add,               SIGNAL(triggered()), this,           SLOT(addTitleBlockTemplate()));
@@ -299,6 +301,17 @@
 }
 
 /**
+	Emet le signal requestForDiagramMoveUpTop avec le schema selectionne
++ */
+void ElementsPanelWidget::moveDiagramUpTop() {
+	if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
+		emit(requestForDiagramMoveUpTop(selected_diagram));
+	}
+}
+
+
+
+/**
 	Emet le signal requestForDiagramMoveUp avec le schema selectionne
 */
 void ElementsPanelWidget::moveDiagramUp() {
@@ -455,6 +468,7 @@
 		prj_del_diagram       -> setEnabled(is_writable);
 		prj_move_diagram_up   -> setEnabled(is_writable && diagram_position > 0);
 		prj_move_diagram_down -> setEnabled(is_writable && diagram_position < project_diagrams_count - 1);
+		prj_move_diagram_top   -> setEnabled(is_writable && diagram_position > 0);
 		prj_move_diagram_upx10   -> setEnabled(is_writable && diagram_position > 10);
 		prj_move_diagram_downx10 -> setEnabled(is_writable && diagram_position < project_diagrams_count - 10);
 		setElementsActionEnabled(false);
@@ -559,6 +573,7 @@
 		case QET::Diagram:
 			context_menu -> addAction(prj_prop_diagram);
 			context_menu -> addAction(prj_del_diagram);
+			context_menu -> addAction(prj_move_diagram_top);
 			context_menu -> addAction(prj_move_diagram_upx10);
 			context_menu -> addAction(prj_move_diagram_up);
 			context_menu -> addAction(prj_move_diagram_down);

Modified: trunk/sources/elementspanelwidget.h
===================================================================
--- trunk/sources/elementspanelwidget.h	2015-03-03 20:53:13 UTC (rev 3798)
+++ trunk/sources/elementspanelwidget.h	2015-03-04 06:00:25 UTC (rev 3799)
@@ -44,7 +44,7 @@
 	QAction *new_category, *edit_category, *delete_category;
 	QAction *delete_collection;
 	QAction *new_element, *edit_element, *delete_element, *open_element;
-	QAction *prj_activate, *prj_close, *prj_edit_prop, *prj_prop_diagram, *prj_add_diagram, *prj_del_diagram, *prj_move_diagram_up, *prj_move_diagram_down, *prj_move_diagram_upx10, *prj_move_diagram_downx10;
+	QAction *prj_activate, *prj_close, *prj_edit_prop, *prj_prop_diagram, *prj_add_diagram, *prj_del_diagram, *prj_move_diagram_up, *prj_move_diagram_top, *prj_move_diagram_down, *prj_move_diagram_upx10, *prj_move_diagram_downx10;
 	QAction *tbt_add, *tbt_edit, *tbt_remove;
 	QAction *copy_elements_, *move_elements_, *cancel_elements_;
 	QMenu *context_menu;
@@ -67,6 +67,7 @@
 	void requestForDiagramDeletion(Diagram *);
 	void requestForDiagramMoveUp(Diagram *);
 	void requestForDiagramMoveDown(Diagram *);
+	void requestForDiagramMoveUpTop(Diagram *);
 	void requestForDiagramMoveUpx10(Diagram *);
 	void requestForDiagramMoveDownx10(Diagram *);
 	
@@ -83,6 +84,7 @@
 	void deleteDiagram();
 	void moveDiagramUp();
 	void moveDiagramDown();
+	void moveDiagramUpTop();
 	void moveDiagramUpx10();
 	void moveDiagramDownx10();
 	void addTitleBlockTemplate();

Modified: trunk/sources/projectview.cpp
===================================================================
--- trunk/sources/projectview.cpp	2015-03-03 20:53:13 UTC (rev 3798)
+++ trunk/sources/projectview.cpp	2015-03-04 06:00:25 UTC (rev 3799)
@@ -502,6 +502,28 @@
 }
 
 /**
+	Deplace le schema diagram_view vers le haut / la gauche en position 0
+*/
+void ProjectView::moveDiagramUpTop(DiagramView *diagram_view) {
+	if (!diagram_view) return;
+
+	int diagram_view_position = diagram_ids_.key(diagram_view);
+	if (!diagram_view_position) {
+		// le schema est le premier du projet
+		return;
+	}
+	tabs_ -> moveTab(diagram_view_position, (diagrams().size()-1, 0));
+}
+
+/**
+	Deplace le schema diagram vers le haut / la gauche en position 0
+*/
+void ProjectView::moveDiagramUpTop(Diagram *diagram) {
+	moveDiagramUpTop(findDiagram(diagram));
+}
+
+
+/**
 	Deplace le schema diagram_view vers le haut / la gauche x10
 */
 void ProjectView::moveDiagramUpx10(DiagramView *diagram_view) {

Modified: trunk/sources/projectview.h
===================================================================
--- trunk/sources/projectview.h	2015-03-03 20:53:13 UTC (rev 3798)
+++ trunk/sources/projectview.h	2015-03-04 06:00:25 UTC (rev 3799)
@@ -73,6 +73,8 @@
 	void moveDiagramUp(Diagram *);
 	void moveDiagramDown(DiagramView *);
 	void moveDiagramDown(Diagram *);
+	void moveDiagramUpTop(DiagramView *);
+	void moveDiagramUpTop(Diagram *);
 	void moveDiagramUpx10(DiagramView *);
 	void moveDiagramUpx10(Diagram *);
 	void moveDiagramDownx10(DiagramView *);

Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp	2015-03-03 20:53:13 UTC (rev 3798)
+++ trunk/sources/qetdiagrameditor.cpp	2015-03-04 06:00:25 UTC (rev 3799)
@@ -144,6 +144,7 @@
 	connect(pa, SIGNAL(requestForDiagramDeletion          (Diagram *)), this, SLOT(removeDiagram(Diagram *)));
 	connect(pa, SIGNAL(requestForDiagramMoveUp            (Diagram *)), this, SLOT(moveDiagramUp(Diagram *)));
 	connect(pa, SIGNAL(requestForDiagramMoveDown          (Diagram *)), this, SLOT(moveDiagramDown(Diagram *)));
+	connect(pa, SIGNAL(requestForDiagramMoveUpTop         (Diagram *)), this, SLOT(moveDiagramUpTop(Diagram *)));
 	connect(pa, SIGNAL(requestForDiagramMoveUpx10         (Diagram *)), this, SLOT(moveDiagramUpx10(Diagram *)));
 	connect(pa, SIGNAL(requestForDiagramMoveDownx10       (Diagram *)), this, SLOT(moveDiagramDownx10(Diagram *)));
 }
@@ -1839,7 +1840,26 @@
 	}
 }
 
+/**
+	Change l'ordre des schemas d'un projet, en decalant le schema vers le haut /
+	la gauche en position 0
+	@param diagram Schema a decaler vers le haut / la gauche en position 0
+ */
+void QETDiagramEditor::moveDiagramUpTop(Diagram *diagram) {
+	if (!diagram) return;
 
+	// recupere le projet contenant le schema
+	if (QETProject *diagram_project = diagram -> project()) {
+		if (diagram_project -> isReadOnly()) return;
+
+		// recupere la vue sur ce projet
+		if (ProjectView *project_view = findProject(diagram_project)) {
+			project_view -> moveDiagramUpTop(diagram);
+		}
+	}
+}
+
+
 /**
 	Change l'ordre des schemas d'un projet, en decalant le schema vers le haut /
 	la gauche x10

Modified: trunk/sources/qetdiagrameditor.h
===================================================================
--- trunk/sources/qetdiagrameditor.h	2015-03-03 20:53:13 UTC (rev 3798)
+++ trunk/sources/qetdiagrameditor.h	2015-03-04 06:00:25 UTC (rev 3799)
@@ -145,6 +145,7 @@
 		void removeDiagramFromProject();
 		void moveDiagramUp(Diagram *);
 		void moveDiagramDown(Diagram *);
+		void moveDiagramUpTop(Diagram *);
 		void moveDiagramUpx10(Diagram *);
 		void moveDiagramDownx10(Diagram *);
 		void cleanCurrentProject();


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