[qet] [3863] -Replace option : draw grid outside of border by zoom out beyond of folio.

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


Revision: 3863
Author:   blacksun
Date:     2015-03-29 14:15:25 +0200 (Sun, 29 Mar 2015)
Log Message:
-----------
-Replace option : draw grid outside of border by zoom out beyond of folio.
When option is to true, zoom out is infinite and grid is draw outside of border.
-Zoom out with mouse wheel is now more slowly

Modified Paths:
--------------
    trunk/sources/configpages.cpp
    trunk/sources/configpages.h
    trunk/sources/diagram.cpp
    trunk/sources/diagramview.cpp

Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp	2015-03-27 09:52:16 UTC (rev 3862)
+++ trunk/sources/configpages.cpp	2015-03-29 12:15:25 UTC (rev 3863)
@@ -186,7 +186,7 @@
 	bool use_system_colors = settings.value("usesystemcolors", "true").toBool();
 	bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
 	bool integrate_elements = settings.value("diagrameditor/integrate-elements", true).toBool();
-	bool grid_outside = settings.value("diagrameditor/draw-grid-outside-of-border", false).toBool();
+	bool zoom_out_folio = settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool();
 	bool use_trackpad = settings.value("diagramview/gestures", false).toBool();
 	bool highlight_integrated_elements = settings.value("diagrameditor/highlight-integrated-elements", true).toBool();
 	QString default_element_informations = settings.value("elementeditor/default-informations", "").toString();
@@ -197,7 +197,7 @@
     windowed_mode_ = new QRadioButton(tr("Utiliser des fenêtres (appliqué au prochain lancement de QElectroTech)"), projects_view_mode_);
     tabbed_mode_ = new QRadioButton(tr("Utiliser des onglets (appliqué au prochain lancement de QElectroTech)"), projects_view_mode_);
 	use_trackpad_ = new QCheckBox(tr("Utiliser les gestes du pavé tactile"), projects_view_mode_);
-    m_grid_outside_border = new QCheckBox(tr("Dessiner la grille au-delà du cadre du folio"), this);
+	m_zoom_out_beyond_folio = new QCheckBox(tr("Autoriser le dézoom au delà du folio"), this);
 	
 	elements_management_ = new QGroupBox(tr("Gestion des éléments"), this);
 	integrate_elements_ = new QCheckBox(tr("Intégrer automatiquement les éléments dans les projets (recommandé)"));
@@ -222,7 +222,7 @@
 		windowed_mode_ -> setChecked(true);
 	}
 
-	m_grid_outside_border -> setChecked(grid_outside);
+	m_zoom_out_beyond_folio -> setChecked(zoom_out_folio);
 	
 	integrate_elements_ -> setChecked(integrate_elements);
 	highlight_integrated_elements_ -> setChecked(highlight_integrated_elements);
@@ -235,7 +235,7 @@
 	QVBoxLayout *projects_view_mode_layout = new QVBoxLayout;
 	projects_view_mode_layout -> addWidget(windowed_mode_);
 	projects_view_mode_layout -> addWidget(tabbed_mode_);
-    projects_view_mode_layout -> addWidget(m_grid_outside_border);
+	projects_view_mode_layout -> addWidget(m_zoom_out_beyond_folio);
     projects_view_mode_layout -> addWidget(use_trackpad_);
 	projects_view_mode_ -> setLayout(projects_view_mode_layout);
 	
@@ -300,7 +300,7 @@
 	settings.setValue("diagrameditor/highlight-integrated-elements", highlight_integrated_elements_ -> isChecked());
 	settings.setValue("elementeditor/default-informations", default_element_infos_textfield_ -> toPlainText());
 	settings.setValue("diagramview/gestures", use_trackpad_ -> isChecked());
-	settings.setValue("diagrameditor/draw-grid-outside-of-border", m_grid_outside_border->isChecked());
+	settings.setValue("diagrameditor/zoom-out-beyond-of-folio", m_zoom_out_beyond_folio->isChecked());
 }
 
 /// @return l'icone de cette page

Modified: trunk/sources/configpages.h
===================================================================
--- trunk/sources/configpages.h	2015-03-27 09:52:16 UTC (rev 3862)
+++ trunk/sources/configpages.h	2015-03-29 12:15:25 UTC (rev 3863)
@@ -89,7 +89,7 @@
 	QGroupBox *projects_view_mode_;
 	QRadioButton *windowed_mode_;
 	QRadioButton *tabbed_mode_;
-	QCheckBox *m_grid_outside_border;
+	QCheckBox *m_zoom_out_beyond_folio;
 	QLabel *warning_view_mode_;
 	QGroupBox *elements_management_;
 	QCheckBox *integrate_elements_;

Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp	2015-03-27 09:52:16 UTC (rev 3862)
+++ trunk/sources/diagram.cpp	2015-03-29 12:15:25 UTC (rev 3863)
@@ -139,7 +139,8 @@
 
 		p -> setBrush(Qt::NoBrush);
 
-		QRectF rect = QETApp::settings().value("diagrameditor/draw-grid-outside-of-border", false).toBool() ?
+			//If user allow zoom out beyond of folio, we draw grid outside of border.
+		QRectF rect = QETApp::settings().value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ?
 						  r :
 						  border_and_titleblock.insideBorderRect().intersected(r);
 

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2015-03-27 09:52:16 UTC (rev 3862)
+++ trunk/sources/diagramview.cpp	2015-03-29 12:15:25 UTC (rev 3863)
@@ -350,41 +350,46 @@
 }
 
 /**
-	Agrandit le schema (+33% = inverse des -25 % de zoomMoins())
-*/
+ * @brief DiagramView::zoomIn
+ * Zoom in the current folio
+ */
 void DiagramView::zoomIn() {
-	scale(4.0/3.0, 4.0/3.0);
+	scale(1.15, 1.15);
 	adjustGridToZoom();
 }
 
 /**
-	Retrecit le schema (-25% = inverse des +33 % de zoomPlus())
-*/
+ * @brief DiagramView::zoomOut
+ * Zoom out the current folio.
+ * If zoom-out-beyond-of-folio is true in common setting, the zoom out is infinite
+ * else zoom out is stopped when the entire folio is visible.
+ */
 void DiagramView::zoomOut() {
-	scale(0.75, 0.75);
-	if ((mapFromScene(0,0).rx() == 0) && (mapFromScene(0,0).ry() == 0)){
-		fitInView(sceneRect(), Qt::KeepAspectRatio);
-	}
+	if (QETApp::settings().value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
+		(horizontalScrollBar()->maximum() || verticalScrollBar()->maximum()) )
+		scale(0.85, 0.85);
+
 	adjustGridToZoom();
 }
 
 /**
-	Agrandit le schema avec le trackpad
-*/
+ * @brief DiagramView::zoomInSlowly
+ * Like zoomIn but more slowly
+ */
 void DiagramView::zoomInSlowly() {
 	scale(1.02, 1.02);
 	adjustGridToZoom();
 }
 
 /**
-	Retrecit le schema avec le trackpad
-*/
+ * @brief DiagramView::zoomOutSlowly
+ * Like zoomOut but more slowly
+ */
 void DiagramView::zoomOutSlowly() {
-	scale(0.98, 0.98);
-    // Interdit le dezoome plus grand que le folio
-	if ((mapFromScene(0,0).rx() == 0) && (mapFromScene(0,0).ry() == 0)){
-		fitInView(sceneRect(), Qt::KeepAspectRatio);
-	}
+	if (QETApp::settings().value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
+		(horizontalScrollBar()->maximum() || verticalScrollBar()->maximum()) )
+		scale(0.98, 0.98);
+
 	adjustGridToZoom();
 }
 
@@ -780,8 +785,6 @@
 {
 	QRectF scene_rect = scene->sceneRect();
 	scene_rect.adjust(-Diagram::margin, -Diagram::margin, Diagram::margin, Diagram::margin);
-	scene_rect.setWidth(scene_rect.width()*2);
-	scene_rect.setHeight(scene_rect.height()*2);
 	setSceneRect(scene_rect);
 }
 


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