Permalink
Browse files

Merge pull request #58 from ericksson/master

More consistency fixes
  • Loading branch information...
2 parents 584f694 + 343e934 commit f8fc3625a8bb4373b0253f9385935b20efcb7e52 @cameronwhite cameronwhite committed May 10, 2013
@@ -381,7 +381,14 @@ private void HandlerPintaCoreActionsEditSavePaletteActivated (object sender, Eve
if (response == (int) Gtk.ResponseType.Ok) {
Palette.FileFormat format = (fcd.Filter == ffPDN) ? Palette.FileFormat.PDN : Palette.FileFormat.GIMP;
- PintaCore.Palette.CurrentPalette.Save (fcd.Filename, format);
+
+ string fileExtension = (fcd.Filter == ffPDN) ? ".txt" : ".gpl";
+ string finalFileName = fcd.Filename;
+ bool fileNameHasExtension = finalFileName.EndsWith(".txt") || finalFileName.EndsWith(".gpl");
+ if (!fileNameHasExtension)
+ finalFileName += fileExtension;
+
+ PintaCore.Palette.CurrentPalette.Save (finalFileName, format);
}
fcd.Destroy ();
@@ -37,8 +37,10 @@ public class ColorPaletteWidget : Gtk.DrawingArea
private Rectangle primary_rect = new Rectangle (7, 7, 30, 30);
private Rectangle secondary_rect = new Rectangle (22, 22, 30, 30);
private Rectangle swap_rect = new Rectangle (37, 6, 15, 15);
+ private Rectangle reset_rect = new Rectangle (7, 37, 15, 15);
private Gdk.Pixbuf swap_icon;
+ private Gdk.Pixbuf reset_icon;
private Palette palette;
public ColorPaletteWidget ()
@@ -47,6 +49,7 @@ public ColorPaletteWidget ()
this.AddEvents ((int)Gdk.EventMask.ButtonPressMask);
swap_icon = PintaCore.Resources.GetIcon ("ColorPalette.SwapIcon.png");
+ reset_icon = PintaCore.Resources.GetIcon ("ColorPalette.ResetIcon.png");
palette = PintaCore.Palette.CurrentPalette;
HasTooltip = true;
@@ -78,6 +81,10 @@ protected override bool OnButtonPressEvent (Gdk.EventButton ev)
PintaCore.Palette.PrimaryColor = PintaCore.Palette.SecondaryColor;
PintaCore.Palette.SecondaryColor = temp;
GdkWindow.Invalidate ();
+ } else if (reset_rect.ContainsPoint (ev.X, ev.Y)) {
+ PintaCore.Palette.PrimaryColor = new Color (0, 0, 0);
+ PintaCore.Palette.SecondaryColor = new Color (1, 1, 1);
+ GdkWindow.Invalidate ();
}
if (primary_rect.ContainsPoint (ev.X, ev.Y)) {
@@ -159,6 +166,7 @@ protected override bool OnExposeEvent (Gdk.EventExpose ev)
g.DrawRectangle (primary_rect, new Color (0, 0, 0), 1);
g.DrawPixbuf (swap_icon, swap_rect.Location ());
+ g.DrawPixbuf (reset_icon, reset_rect.Location ());
// Draw swatches
int roundedCount = (palette.Count % 3 == 0) ?
@@ -217,6 +225,8 @@ private void HandleQueryTooltip (object o, Gtk.QueryTooltipArgs args)
if (swap_rect.ContainsPoint (x, y)) {
text = Catalog.GetString ("Click to switch between primary and secondary color.");
+ } else if (reset_rect.ContainsPoint (x, y)) {
+ text = Catalog.GetString ("Click to reset primary and secondary color.");
} else if (primary_rect.ContainsPoint (x, y)) {
text = Catalog.GetString ("Click to select primary color.");
} else if (secondary_rect.ContainsPoint (x, y)) {
@@ -86,6 +86,9 @@
<EmbeddedResource Include="Resources\Cursor.MagicWand.png">
<LogicalName>Cursor.MagicWand.png</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="Resources\Cursor.Gradient.png">
+ <LogicalName>Cursor.Gradient.png</LogicalName>
+ </EmbeddedResource>
<EmbeddedResource Include="Resources\Cursor.Text.png">
<LogicalName>Cursor.Text.png</LogicalName>
</EmbeddedResource>
@@ -185,6 +188,9 @@
<EmbeddedResource Include="Resources\ColorPalette.SwapIcon.png">
<LogicalName>ColorPalette.SwapIcon.png</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="Resources\ColorPalette.ResetIcon.png">
+ <LogicalName>ColorPalette.ResetIcon.png</LogicalName>
+ </EmbeddedResource>
<EmbeddedResource Include="Resources\Tools.Paintbrush.png">
<LogicalName>Tools.Paintbrush.png</LogicalName>
</EmbeddedResource>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -63,6 +63,7 @@ static GradientTool ()
get { return Catalog.GetString ("Click and drag to draw gradient from primary to secondary color. Right click to reverse."); }
}
public override Gdk.Key ShortcutKey { get { return Gdk.Key.G; } }
+ public override Gdk.Cursor DefaultCursor { get { return new Gdk.Cursor (PintaCore.Chrome.Canvas.Display, PintaCore.Resources.GetIcon ("Cursor.Gradient.png"), 13, 13); } }
public override int Priority { get { return 23; } }
#region Mouse Handlers
@@ -74,6 +74,8 @@ protected override void OnBuildToolBar (Toolbar tb)
// Change the cursor when the BrushWidth is changed.
brush_width.ComboBox.Changed += (sender, e) => SetCursor (DefaultCursor);
+ tb.AppendItem (new Gtk.SeparatorToolItem ());
+
if (brush_label == null)
brush_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Type")));
@@ -69,8 +69,10 @@ protected override void OnBuildToolBar (Gtk.Toolbar tb)
{
base.OnBuildToolBar (tb);
+ tb.AppendItem (new Gtk.SeparatorToolItem ());
+
if (tolerance_label == null)
- tolerance_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Tolerance")));
+ tolerance_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Tolerance")));
tb.AppendItem (tolerance_label);
@@ -231,6 +231,8 @@ protected override void OnBuildToolBar (Gtk.Toolbar tb)
tb.AppendItem (fill_button);
+ tb.AppendItem (new SeparatorToolItem ());
+
if (outline_width_label == null)
outline_width_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Outline width")));
View
@@ -33,23 +33,27 @@ msgstr ""
msgid "Choose Secondary Color"
msgstr ""
-#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:123
+#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:130
msgid "Choose Palette Color"
msgstr ""
-#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:219
+#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:227
msgid "Click to switch between primary and secondary color."
msgstr ""
-#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:221
+#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:229
+msgid "Click to reset primary and secondary color."
+msgstr ""
+
+#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:231
msgid "Click to select primary color."
msgstr ""
-#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:223
+#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:233
msgid "Click to select secondary color."
msgstr ""
-#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:225
+#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:235
msgid ""
"Left click to set primary color. Right click to set secondary color. Middle "
"click to choose palette color."

0 comments on commit f8fc362

Please sign in to comment.