- Added new actions "Hide" and "Reveal" which allow direct setting of objects' visibility setting instead of toggling it.

Tue, 22 Oct 2013 21:39:20 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 22 Oct 2013 21:39:20 +0300
changeset 530
f9476dbd87ec
parent 529
c294b2070185
child 531
06399c3ce69b

- Added new actions "Hide" and "Reveal" which allow direct setting of objects' visibility setting instead of toggling it.

changelog.txt file | annotate | diff | comparison | revisions
icons/visibility-show.png file | annotate | diff | comparison | revisions
icons/visibility.png file | annotate | diff | comparison | revisions
ldforge.qrc file | annotate | diff | comparison | revisions
src/actions.h file | annotate | diff | comparison | revisions
src/gui.cpp file | annotate | diff | comparison | revisions
src/gui_actions.cpp file | annotate | diff | comparison | revisions
ui/ldforge.ui file | annotate | diff | comparison | revisions
--- a/changelog.txt	Tue Oct 22 21:03:57 2013 +0300
+++ b/changelog.txt	Tue Oct 22 21:39:20 2013 +0300
@@ -22,6 +22,8 @@
 	gives the opportunity to see the other config fields)
 - Added new action "Add History Line" for quickly inserting 0 !HISTORY lines to headers
 - Added new action "Go to line", default shortcut Ctrl-G. It should be obvious what it does.
+- Added new actions "Hide" and "Reveal" which allow direct setting of objects' visibility setting instead of
+	toggling it.
 - Added support for logoed studs, this should satisfy Steffen. :p
 - Added support for '0 BFC CLIP' and '0 BFC NOCLIP' and added auto-correction from errorneous MLCAD
 	syntax ('0 BFC CERTIFY CLIP').
Binary file icons/visibility-show.png has changed
Binary file icons/visibility.png has changed
--- a/ldforge.qrc	Tue Oct 22 21:03:57 2013 +0300
+++ b/ldforge.qrc	Tue Oct 22 21:39:20 2013 +0300
@@ -99,7 +99,9 @@
 	<file>./icons/uncolorize.png</file>
 	<file>./icons/undo.png</file>
 	<file>./icons/vertex.png</file>
-	<file>./icons/visibility.png</file>
+	<file>./icons/visibility-hide.png</file>
+	<file>./icons/visibility-show.png</file>
+	<file>./icons/visibility-toggle.png</file>
 	<file>./icons/wireframe.png</file>
 	<file>./icons/ytruder.png</file>
 	<file>data/primitive-categories.cfg</file>
--- a/src/actions.h	Tue Oct 22 21:03:57 2013 +0300
+++ b/src/actions.h	Tue Oct 22 21:39:20 2013 +0300
@@ -72,7 +72,9 @@
 act (Borders)
 act (CornerVerts)
 act (RoundCoordinates)
-act (Visibility)
+act (VisibilityHide)
+act (VisibilityReveal)
+act (VisibilityToggle)
 act (ReplaceCoords)
 act (Flip)
 act (Demote)
--- a/src/gui.cpp	Tue Oct 22 21:03:57 2013 +0300
+++ b/src/gui.cpp	Tue Oct 22 21:39:20 2013 +0300
@@ -345,12 +345,15 @@
 			} break;
 		}
 
-		// Put it into brackets if it's hidden
-		if (obj->hidden())
-			descr = fmt ("[[ %1 ]]", descr);
-
 		QListWidgetItem* item = new QListWidgetItem (descr);
 		item->setIcon (getIcon (obj->typeName()));
+		
+		// Use italic font if hidden
+		if (obj->hidden())
+		{	QFont font = item->font();
+			font.setItalic (true);
+			item->setFont (font);
+		}
 
 		// Color gibberish orange on red so it stands out.
 		if (obj->getType() == LDObject::Error)
--- a/src/gui_actions.cpp	Tue Oct 22 21:03:57 2013 +0300
+++ b/src/gui_actions.cpp	Tue Oct 22 21:39:20 2013 +0300
@@ -472,7 +472,7 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-DEFINE_ACTION (Visibility, 0)
+DEFINE_ACTION (VisibilityToggle, 0)
 {	for (LDObject* obj : selection())
 		obj->setHidden (!obj->hidden());
 
@@ -481,6 +481,24 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
+DEFINE_ACTION (VisibilityHide, 0)
+{	for (LDObject* obj : selection())
+		obj->setHidden (true);
+	
+	g_win->refresh();
+}
+
+// =============================================================================
+// -----------------------------------------------------------------------------
+DEFINE_ACTION (VisibilityReveal, 0)
+{	for (LDObject* obj : selection())
+	obj->setHidden (false);
+	
+	g_win->refresh();
+}
+
+// =============================================================================
+// -----------------------------------------------------------------------------
 DEFINE_ACTION (Wireframe, 0)
 {	gl_wireframe = !gl_wireframe;
 	g_win->R()->refresh();
--- a/ui/ldforge.ui	Tue Oct 22 21:03:57 2013 +0300
+++ b/ui/ldforge.ui	Tue Oct 22 21:39:20 2013 +0300
@@ -70,7 +70,7 @@
      <x>0</x>
      <y>0</y>
      <width>900</width>
-     <height>26</height>
+     <height>24</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
@@ -182,10 +182,13 @@
     <addaction name="actionBorders"/>
     <addaction name="actionCornerVerts"/>
     <addaction name="actionRoundCoordinates"/>
-    <addaction name="actionVisibility"/>
     <addaction name="actionReplaceCoords"/>
     <addaction name="actionFlip"/>
     <addaction name="actionDemote"/>
+    <addaction name="separator"/>
+    <addaction name="actionVisibilityHide"/>
+    <addaction name="actionVisibilityToggle"/>
+    <addaction name="actionVisibilityReveal"/>
    </widget>
    <widget class="QMenu" name="menuExternal_Tools">
     <property name="title">
@@ -294,6 +297,7 @@
    <attribute name="toolBarBreak">
     <bool>false</bool>
    </attribute>
+   <addaction name="actionDownloadFrom"/>
    <addaction name="actionNewSubfile"/>
    <addaction name="actionNewLine"/>
    <addaction name="actionNewTriangle"/>
@@ -377,11 +381,15 @@
    <addaction name="actionUncolorize"/>
    <addaction name="actionInvert"/>
    <addaction name="actionSplitQuads"/>
+   <addaction name="actionInline"/>
    <addaction name="actionEditRaw"/>
    <addaction name="actionBorders"/>
+   <addaction name="actionCornerVerts"/>
    <addaction name="actionReplaceCoords"/>
    <addaction name="actionRoundCoordinates"/>
-   <addaction name="actionVisibility"/>
+   <addaction name="actionVisibilityHide"/>
+   <addaction name="actionVisibilityToggle"/>
+   <addaction name="actionVisibilityReveal"/>
   </widget>
   <widget class="QToolBar" name="toolBar_8">
    <property name="windowTitle">
@@ -954,10 +962,10 @@
     <string>Round coordinates down to 3/4 decimals</string>
    </property>
   </action>
-  <action name="actionVisibility">
+  <action name="actionVisibilityToggle">
    <property name="icon">
     <iconset resource="../ldforge.qrc">
-     <normaloff>:/icons/visibility.png</normaloff>:/icons/visibility.png</iconset>
+     <normaloff>:/icons/visibility-toggle.png</normaloff>:/icons/visibility-toggle.png</iconset>
    </property>
    <property name="text">
     <string>Toggle Visibility</string>
@@ -1291,6 +1299,30 @@
     <string>Circle Mode</string>
    </property>
   </action>
+  <action name="actionVisibilityHide">
+   <property name="icon">
+    <iconset resource="../ldforge.qrc">
+     <normaloff>:/icons/visibility-hide.png</normaloff>:/icons/visibility-hide.png</iconset>
+   </property>
+   <property name="text">
+    <string>Hide</string>
+   </property>
+   <property name="toolTip">
+    <string>Hides objects from view</string>
+   </property>
+  </action>
+  <action name="actionVisibilityReveal">
+   <property name="icon">
+    <iconset resource="../ldforge.qrc">
+     <normaloff>:/icons/visibility-show.png</normaloff>:/icons/visibility-show.png</iconset>
+   </property>
+   <property name="text">
+    <string>Reveal</string>
+   </property>
+   <property name="toolTip">
+    <string>Reveals objects. Undoes hiding.</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="../ldforge.qrc"/>

mercurial