[haiku-commits] haiku: hrev46600 - in src/apps/icon-o-matic: gui document/savers

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 26 Dec 2013 00:21:32 +0100 (CET)

hrev46600 adds 3 changesets to branch 'master'
old head: 9f79c0ca9a386ae6f98498cf238381abbca82042
new head: 26b4c54975c0a7c50a246a463119c8a523cabe2c
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=26b4c54+%5E9f79c0c

----------------------------------------------------------------------------

2ae82f9: List.h: Missing include (when used with POD == true)

493c0c2: Icon-O-Matic: Adjust save file panel title as intended.
  
   * SetExportMode() was supposed to toggle the panel title from "*Save*" to
     "*Export*", but never called Window()->SetTitle().
   * Remove now duplicate translation from constructor.

26b4c54: Icon-O-Matic: sprintf -> snprintf

                                      [ Stephan Aßmus <superstippi@xxxxxx> ]

----------------------------------------------------------------------------

3 files changed, 17 insertions(+), 11 deletions(-)
src/apps/haiku-depot/List.h                      |  1 +
.../document/savers/BitmapSetSaver.cpp           |  6 +++---
src/apps/icon-o-matic/gui/SavePanel.cpp          | 21 ++++++++++++--------

############################################################################

Commit:      2ae82f9fb5b62f84ba672c77337f63283536abe0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2ae82f9
Author:      Stephan Aßmus <superstippi@xxxxxx>
Date:        Fri Dec 13 20:43:02 2013 UTC

List.h: Missing include (when used with POD == true)

----------------------------------------------------------------------------

diff --git a/src/apps/haiku-depot/List.h b/src/apps/haiku-depot/List.h
index 03d1a96..68ee613 100644
--- a/src/apps/haiku-depot/List.h
+++ b/src/apps/haiku-depot/List.h
@@ -8,6 +8,7 @@
 
 #include <new>
 #include <stdlib.h>
+#include <string.h>
 
 #include <SupportDefs.h>
 

############################################################################

Commit:      493c0c2b5138585fcac37a0a7906c790981886a3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=493c0c2
Author:      Stephan Aßmus <superstippi@xxxxxx>
Date:        Wed Dec 25 23:16:59 2013 UTC

Icon-O-Matic: Adjust save file panel title as intended.

 * SetExportMode() was supposed to toggle the panel title from "*Save*" to
   "*Export*", but never called Window()->SetTitle().
 * Remove now duplicate translation from constructor.

----------------------------------------------------------------------------

diff --git a/src/apps/icon-o-matic/gui/SavePanel.cpp 
b/src/apps/icon-o-matic/gui/SavePanel.cpp
index a3d107a..40c3fca 100644
--- a/src/apps/icon-o-matic/gui/SavePanel.cpp
+++ b/src/apps/icon-o-matic/gui/SavePanel.cpp
@@ -71,16 +71,16 @@ SavePanel::SavePanel(const char* name,
        if (!window || !window->Lock())
                return;
 
-       window->SetTitle(B_TRANSLATE("Save image"));
-
        // add this instance as BHandler to the window's looper
        window->AddHandler(this);
        
        // find a couple of important views and mess with their layout
        BView* background = Window()->ChildAt(0);
-       BButton* cancel = dynamic_cast<BButton*>(background->FindView("cancel 
button"));
+       BButton* cancel = dynamic_cast<BButton*>(
+               background->FindView("cancel button"));
        BView* textview = background->FindView("text view");
-       BScrollBar* hscrollbar = 
dynamic_cast<BScrollBar*>(background->FindView("HScrollBar"));
+       BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(
+               background->FindView("HScrollBar"));
 
        if (!background || !cancel || !textview || !hscrollbar) {
                printf("SavePanel::SavePanel() - couldn't find necessary 
controls.\n");
@@ -141,7 +141,8 @@ SavePanel::SavePanel(const char* name,
        textview->ResizeTo(fSettingsB->Frame().right - fFormatMF->Frame().left,
                                           textview->Frame().Height());
 
-       // Make sure the smallest window won't draw the "Settings" button over 
anything else
+       // Make sure the smallest window won't draw the "Settings" button over
+       // anything else
        float minWindowWidth = textview->Bounds().Width()
                                                        + 
cancel->Bounds().Width()
                                                        + (insert ? 
insert->Bounds().Width() : 0.0)
@@ -151,6 +152,9 @@ SavePanel::SavePanel(const char* name,
                Window()->ResizeTo(minWindowWidth, Window()->Bounds().Height());
 
 
+       // Init window title
+       SetExportMode(true);
+
        window->Unlock();
 }
 
@@ -201,12 +205,12 @@ SavePanel::SetExportMode(bool exportMode)
                return;
 
        // adjust window title and enable format menu
-       BString helper("Icon-O-Matic: ");
+       BString title("Icon-O-Matic: ");
        if (exportMode) {
                fFormatMF->SetEnabled(true);
                SetExportMode(fExportMode);
                _EnableSettings();
-               helper << B_TRANSLATE_CONTEXT("Export Icon", "Dialog title");
+               title << B_TRANSLATE_CONTEXT("Export icon", "Dialog title");
        } else {
                fExportMode = ExportMode();
                        // does not overwrite fExportMode in case we already 
were
@@ -215,9 +219,10 @@ SavePanel::SetExportMode(bool exportMode)
 
                fFormatMF->SetEnabled(false);
                fSettingsB->SetEnabled(false);
-               helper << B_TRANSLATE_CONTEXT("Save Icon", "Dialog title");
+               title << B_TRANSLATE_CONTEXT("Save icon", "Dialog title");
        }
 
+       window->SetTitle(title);
        window->Unlock();
 }
 

############################################################################

Revision:    hrev46600
Commit:      26b4c54975c0a7c50a246a463119c8a523cabe2c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=26b4c54
Author:      Stephan Aßmus <superstippi@xxxxxx>
Date:        Wed Dec 25 23:20:28 2013 UTC

Icon-O-Matic: sprintf -> snprintf

----------------------------------------------------------------------------

diff --git a/src/apps/icon-o-matic/document/savers/BitmapSetSaver.cpp 
b/src/apps/icon-o-matic/document/savers/BitmapSetSaver.cpp
index ed6be4d..9d94323 100644
--- a/src/apps/icon-o-matic/document/savers/BitmapSetSaver.cpp
+++ b/src/apps/icon-o-matic/document/savers/BitmapSetSaver.cpp
@@ -31,21 +31,21 @@ BitmapSetSaver::Save(Document* document)
        char name[B_OS_NAME_LENGTH];
 
        // 64x64
-       sprintf(name, "%s_64.png", fRef.name);
+       snprintf(name, sizeof(name), "%s_64.png", fRef.name);
        actualRef.set_name(name);
        Exporter* exporter = new BitmapExporter(64);
        exporter->SetSelfDestroy(true);
        exporter->Export(document, actualRef);
 
        // 16x16
-       sprintf(name, "%s_16.png", fRef.name);
+       snprintf(name, sizeof(name), "%s_16.png", fRef.name);
        actualRef.set_name(name);
        exporter = new BitmapExporter(16);
        exporter->SetSelfDestroy(true);
        exporter->Export(document, actualRef);
 
        // 32x32
-       sprintf(name, "%s_32.png", fRef.name);
+       snprintf(name, sizeof(name), "%s_32.png", fRef.name);
        actualRef.set_name(name);
        exporter = new BitmapExporter(32);
        exporter->SetSelfDestroy(true);


Other related posts:

  • » [haiku-commits] haiku: hrev46600 - in src/apps/icon-o-matic: gui document/savers - superstippi