[qet] [3551] Add new action DiagramMoveDownx10, DiagramMoveUpx10

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


Revision: 3551
Author:   scorpio810
Date:     2014-12-14 18:01:11 +0100 (Sun, 14 Dec 2014)
Log Message:
-----------
Add new action DiagramMoveDownx10, DiagramMoveUpx10

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	2014-12-14 15:14:24 UTC (rev 3550)
+++ trunk/sources/elementspanelwidget.cpp	2014-12-14 17:01:11 UTC (rev 3551)
@@ -72,6 +72,8 @@
 	prj_del_diagram       = new QAction(QET::Icons::DiagramDelete,             tr("Supprimer ce sch\351ma"),              this);
 	prj_move_diagram_up   = new QAction(QET::Icons::GoUp,                      tr("Remonter ce sch\351ma"),               this);
 	prj_move_diagram_down = new QAction(QET::Icons::GoDown,                    tr("Abaisser ce sch\351ma"),               this);
+	prj_move_diagram_upx10   = new QAction(QET::Icons::GoUp,                   tr("Remonter ce sch\351ma x10"),           this);
+	prj_move_diagram_downx10 = new QAction(QET::Icons::GoDown,                 tr("Abaisser ce sch\351ma x10"),           this);
 	tbt_add               = new QAction(QET::Icons::TitleBlock,                tr("Nouveau mod\350le"),                   this);
 	tbt_edit              = new QAction(QET::Icons::TitleBlock,                tr("\311diter ce mod\350le"),              this);
 	tbt_remove            = new QAction(QET::Icons::TitleBlock,                tr("Supprimer ce mod\350le"),              this);
@@ -118,6 +120,8 @@
 	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_upx10,   SIGNAL(triggered()), this,        SLOT(moveDiagramUpx10()));
+	connect(prj_move_diagram_downx10, SIGNAL(triggered()), this,        SLOT(moveDiagramDownx10()));
 	connect(tbt_add,               SIGNAL(triggered()), this,           SLOT(addTitleBlockTemplate()));
 	connect(tbt_edit,              SIGNAL(triggered()), this,           SLOT(editTitleBlockTemplate()));
 	connect(tbt_remove,            SIGNAL(triggered()), this,           SLOT(removeTitleBlockTemplate()));
@@ -312,6 +316,25 @@
 }
 
 /**
+	Emet le signal requestForDiagramMoveUpx10 avec le schema selectionne
+*/
+void ElementsPanelWidget::moveDiagramUpx10() {
+	if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
+		emit(requestForDiagramMoveUpx10(selected_diagram));
+	}
+}
+
+/**
+	Emet le signal requestForDiagramMoveDownx10 avec le schema selectionne
+*/
+void ElementsPanelWidget::moveDiagramDownx10() {
+	if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
+		emit(requestForDiagramMoveDownx10(selected_diagram));
+	}
+}
+
+
+/**
 	Opens a template editor to create a new title block template.
 */
 void ElementsPanelWidget::addTitleBlockTemplate() {
@@ -431,6 +454,8 @@
 		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_upx10   -> setEnabled(is_writable && diagram_position > 10);
+		prj_move_diagram_downx10 -> setEnabled(is_writable && diagram_position < project_diagrams_count - 10);
 		setElementsActionEnabled(false);
 	} else if (current_type == QET::TitleBlockTemplatesCollection) {
 		TitleBlockTemplateLocation location = elements_panel -> templateLocationForItem(current_item);
@@ -533,8 +558,10 @@
 		case QET::Diagram:
 			context_menu -> addAction(prj_prop_diagram);
 			context_menu -> addAction(prj_del_diagram);
+			context_menu -> addAction(prj_move_diagram_upx10);
 			context_menu -> addAction(prj_move_diagram_up);
 			context_menu -> addAction(prj_move_diagram_down);
+			context_menu -> addAction(prj_move_diagram_downx10);
 			break;
 		case QET::TitleBlockTemplatesCollection:
 			context_menu -> addAction(tbt_add);

Modified: trunk/sources/elementspanelwidget.h
===================================================================
--- trunk/sources/elementspanelwidget.h	2014-12-14 15:14:24 UTC (rev 3550)
+++ trunk/sources/elementspanelwidget.h	2014-12-14 17:01:11 UTC (rev 3551)
@@ -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;
+	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 *tbt_add, *tbt_edit, *tbt_remove;
 	QAction *copy_elements_, *move_elements_, *cancel_elements_;
 	QMenu *context_menu;
@@ -67,6 +67,8 @@
 	void requestForDiagramDeletion(Diagram *);
 	void requestForDiagramMoveUp(Diagram *);
 	void requestForDiagramMoveDown(Diagram *);
+	void requestForDiagramMoveUpx10(Diagram *);
+	void requestForDiagramMoveDownx10(Diagram *);
 	
 	public slots:
 	void clearFilterTextField();
@@ -81,6 +83,8 @@
 	void deleteDiagram();
 	void moveDiagramUp();
 	void moveDiagramDown();
+	void moveDiagramUpx10();
+	void moveDiagramDownx10();
 	void addTitleBlockTemplate();
 	void editTitleBlockTemplate();
 	void removeTitleBlockTemplate();

Modified: trunk/sources/projectview.cpp
===================================================================
--- trunk/sources/projectview.cpp	2014-12-14 15:14:24 UTC (rev 3550)
+++ trunk/sources/projectview.cpp	2014-12-14 17:01:11 UTC (rev 3551)
@@ -502,6 +502,48 @@
 }
 
 /**
+	Deplace le schema diagram_view vers le haut / la gauche x10
+*/
+void ProjectView::moveDiagramUpx10(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, diagram_view_position - 10);
+}
+
+/**
+	Deplace le schema diagram vers le haut / la gauche x10
+*/
+void ProjectView::moveDiagramUpx10(Diagram *diagram) {
+	moveDiagramUpx10(findDiagram(diagram));
+}
+
+/**
+	Deplace le schema diagram_view vers le bas / la droite x10
+*/
+void ProjectView::moveDiagramDownx10(DiagramView *diagram_view) {
+	if (!diagram_view) return;
+
+	int diagram_view_position = diagram_ids_.key(diagram_view);
+	if (diagram_view_position + 1 == diagram_ids_.count()) {
+		// le schema est le dernier du projet
+		return;
+	}
+	tabs_ -> moveTab(diagram_view_position, diagram_view_position + 10);
+}
+
+/**
+	Deplace le schema diagram vers le bas / la droite x10
+*/
+void ProjectView::moveDiagramDownx10(Diagram *diagram) {
+	moveDiagramDownx10(findDiagram(diagram));
+}
+
+/**
 	Ce slot demarre un dialogue permettant a l'utilisateur de parametrer et de
 	lancer l'impression de toute ou partie du projet.
 */

Modified: trunk/sources/projectview.h
===================================================================
--- trunk/sources/projectview.h	2014-12-14 15:14:24 UTC (rev 3550)
+++ trunk/sources/projectview.h	2014-12-14 17:01:11 UTC (rev 3551)
@@ -73,6 +73,10 @@
 	void moveDiagramUp(Diagram *);
 	void moveDiagramDown(DiagramView *);
 	void moveDiagramDown(Diagram *);
+	void moveDiagramUpx10(DiagramView *);
+	void moveDiagramUpx10(Diagram *);
+	void moveDiagramDownx10(DiagramView *);
+	void moveDiagramDownx10(Diagram *);
 	void printProject();
 	void exportProject();
 	QETResult save();

Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp	2014-12-14 15:14:24 UTC (rev 3550)
+++ trunk/sources/qetdiagrameditor.cpp	2014-12-14 17:01:11 UTC (rev 3551)
@@ -156,6 +156,8 @@
 	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(requestForDiagramMoveUpx10         (Diagram *)), this, SLOT(moveDiagramUpx10(Diagram *)));
+	connect(pa, SIGNAL(requestForDiagramMoveDownx10       (Diagram *)), this, SLOT(moveDiagramDownx10(Diagram *)));
 }
 
 /**
@@ -1813,7 +1815,47 @@
 	}
 }
 
+
 /**
+	Change l'ordre des schemas d'un projet, en decalant le schema vers le haut /
+	la gauche x10
+	@param diagram Schema a decaler vers le haut / la gauche x10
+*/
+void QETDiagramEditor::moveDiagramUpx10(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 -> moveDiagramUpx10(diagram);
+		}
+	}
+}
+
+/**
+	Change l'ordre des schemas d'un projet, en decalant le schema vers le bas /
+	la droite x10
+	@param diagram Schema a decaler vers le bas / la droite x10
+*/
+void QETDiagramEditor::moveDiagramDownx10(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 -> moveDiagramDownx10(diagram);
+		}
+	}
+}
+
+
+/**
 	Nettoie le projet courant
 */
 void QETDiagramEditor::cleanCurrentProject() {

Modified: trunk/sources/qetdiagrameditor.h
===================================================================
--- trunk/sources/qetdiagrameditor.h	2014-12-14 15:14:24 UTC (rev 3550)
+++ trunk/sources/qetdiagrameditor.h	2014-12-14 17:01:11 UTC (rev 3551)
@@ -146,6 +146,8 @@
 	void removeDiagramFromProject();
 	void moveDiagramUp(Diagram *);
 	void moveDiagramDown(Diagram *);
+	void moveDiagramUpx10(Diagram *);
+	void moveDiagramDownx10(Diagram *);
 	void cleanCurrentProject();
 	void nomenclatureProject();
 	void diagramWasAdded(DiagramView *);


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