[Uml-devel] CVS: kdesdk/umbrello/umbrello uml.cpp,1.10,1.11

kde at office.kde.org kde at office.kde.org
Mon Feb 3 13:30:29 UTC 2003


Update of /home/kde/kdesdk/umbrello/umbrello
In directory office:/tmp/cvs-serv2593/umbrello/umbrello

Modified Files:
	uml.cpp 
Log Message:
Show current zoom in Zoom menu, even if the zoom is not one
of the "standard" ones (for example because of zoomIn/zoomOut actions)



Index: uml.cpp
===================================================================
RCS file: /home/kde/kdesdk/umbrello/umbrello/uml.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- uml.cpp	2 Feb 2003 23:18:50 -0000	1.10
+++ uml.cpp	3 Feb 2003 21:28:59 -0000	1.11
@@ -106,18 +106,10 @@
 			m->insertItem(i18n("&Zoom"),zoomSelect,-1,m->count()-1);
 		}
 	}
-	//setup zoomSelect menu
+	//connect zoomSelect menu
 	zoomSelect->setCheckable(true);
 	connect(zoomSelect,SIGNAL(aboutToShow()),this,SLOT(setupZoomMenu()));
 	connect(zoomSelect,SIGNAL(activated(int)),this,SLOT(setZoom(int)));
-	//IMPORTANT: The ID's must match the zoom value (text)
-	zoomSelect->insertItem(i18n(" &33 %"),33);
-	zoomSelect->insertItem(i18n(" &50 %"),50);
-	zoomSelect->insertItem(i18n(" &75 %"),75);
-	zoomSelect->insertItem(i18n("&100 %"),100);
-	zoomSelect->insertItem(i18n("1&50 %"),150);
-	zoomSelect->insertItem(i18n("&200 %"),200);
-	zoomSelect->insertItem(i18n("&300 %"),300);
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 UMLApp::~UMLApp() {
@@ -245,13 +237,35 @@
 
 void UMLApp::setupZoomMenu()
 {
+	zoomSelect->clear();
+	
+	//IMPORTANT: The ID's must match the zoom value (text)
+	zoomSelect->insertItem(i18n(" &33 %"),33);
+	zoomSelect->insertItem(i18n(" &50 %"),50);
+	zoomSelect->insertItem(i18n(" &75 %"),75);
+	zoomSelect->insertItem(i18n("&100 %"),100);
+	zoomSelect->insertItem(i18n("1&50 %"),150);
+	zoomSelect->insertItem(i18n("&200 %"),200);
+	zoomSelect->insertItem(i18n("&300 %"),300);
+	
+	
 	int zoom = doc->getCurrentView()->currentZoom();
-
-	//first uncheck all
-	for (uint index = 0; index < zoomSelect->count(); index++) {
-		zoomSelect->setItemChecked(zoomSelect->idAt(index),false);
+	//if current zoom is not a "standard zoom" (because of zoom in / zoom out step
+	//we add it for information
+	switch(zoom){
+		case 33:
+		case 50:
+		case 75:
+		case 100:
+		case 150:
+		case 200:
+		case 300: 
+			break;
+		default:
+			zoomSelect->insertSeparator();
+			zoomSelect->insertItem(QString::number(zoom)+" %",zoom);
 	}
-	zoomSelect->setItemChecked(zoom,true);
+	zoomSelect->setItemChecked(zoom,true);	
 }
 
 void UMLApp::zoomIn()





More information about the umbrello-devel mailing list