Updated Files
libbirdfont/LicenseDialog.vala |
libbirdfont/OverwriteBfFile.vala |
libbirdfont/OverwriteDialog.vala |
libbirdfont/QuestionDialog.vala |
libbirdfont/Renderer/TextArea.vala |
libbirdfont/SaveCallback.vala |
libbirdfont/SaveDialog.vala |
libbirdfont/TabContent.vala |
libbirdfont/Widget.vala |
--- a/libbirdfont/LicenseDialog.vala
+++ b/libbirdfont/LicenseDialog.vala
@@ -50,7 +50,7 @@
height = 240;
}
- void layout () {
+ public override void layout () {
double cx = 0;
double cy = (allocation.height - height) / 2.0;
double center;
--- a/libbirdfont/OverwriteBfFile.vala
+++ b/libbirdfont/OverwriteBfFile.vala
@@ -22,7 +22,7 @@
Button cancel;
public OverwriteBfFile (SaveCallback save_callback) {
- base(t_("This file already exists. Do you want to replace it?"), 200);
+ base(t_("This file already exists. Do you want to replace it?"));
replace = new Button (t_("Replace"));
replace.action.connect (() => {
--- a/libbirdfont/OverwriteDialog.vala
+++ b/libbirdfont/OverwriteDialog.vala
@@ -58,7 +58,7 @@
height = 90 * MainWindow.units;
}
- void layout () {
+ public override void layout () {
double cx = 0;
double cy = (allocation.height - height) / 2.0;
double center;
--- a/libbirdfont/QuestionDialog.vala
+++ b/libbirdfont/QuestionDialog.vala
@@ -19,23 +19,22 @@
public class QuestionDialog : Dialog {
TextArea question;
public Gee.ArrayList<Button> buttons;
-
- double width = 0;
- double height;
static const double font_size = 20;
static const double margin = 20;
+ static const double margin_small = 5;
+
+ double width = 300;
+ double height = 0;
- public QuestionDialog (string message, int height) {
+ public QuestionDialog (string message) {
question = new TextArea (font_size);
question.min_width = 300;
+ question.min_height = font_size;
question.set_editable (false);
question.draw_border = false;
question.text_color = Theme.get_color ("Text Tool Box");
question.set_text (message);
-
- this.height = height;
-
buttons = new Gee.ArrayList<Button> ();
}
@@ -43,9 +42,9 @@
buttons.add (button);
}
- void layout () {
+ public override void layout () {
double cx = 0;
- double cy = (allocation.height - height) / 2.0;
+ double cy;
double center;
double h;
@@ -60,23 +59,34 @@
center = (allocation.width - width) / 2.0;
question.widget_x = margin + center;
- question.widget_y = cy + margin;
- question.allocation = new WidgetAllocation.for_area (0, 0, 300, 450);
+ question.allocation = new WidgetAllocation.for_area (0, 0, 3000, 3000);
question.layout ();
h = question.get_height () + margin;
-
+ print (@"question.get_height (): $(question.get_height ())\n");
+
foreach (Button button in buttons) {
button.widget_x += center;
- button.widget_y = cy + h + margin;
}
+
+ height = h + margin + margin_small;
+
+ if (buttons.size > 0) {
+ height += buttons.get (0).get_height ();
+ }
+
+ cy = (allocation.height - height) / 2.0;
+
+ foreach (Button button in buttons) {
+ button.widget_y = cy + h + margin_small;
+ }
+
+ question.widget_y = cy + margin;
}
public override void draw (Context cr) {
double cx, cy;
- layout ();
-
cx = (allocation.width - width) / 2.0;
cy = (allocation.height - height) / 2.0;
--- a/libbirdfont/Renderer/TextArea.vala
+++ b/libbirdfont/Renderer/TextArea.vala
@@ -880,7 +880,7 @@
}
/** @return offset to click in text. */
- public void layout () {
+ public override void layout () {
double p;
double tx, ty;
string w;
--- a/libbirdfont/SaveCallback.vala
+++ b/libbirdfont/SaveCallback.vala
@@ -19,7 +19,7 @@
public signal void file_saved ();
public bool is_done = false;
- public string file_name = "";
+ public string font_file_path = "";
public SaveCallback () {
file_saved.connect (() => {
@@ -38,11 +38,13 @@
string f;
File file;
OverwriteBfFile dialog;
+ string file_name;
if (fn != null) {
f = (!) fn;
#if MAC
+ font_file_path = f;
save ();
#else
if (!f.has_suffix (".bf")) {
@@ -51,6 +53,7 @@
file_name = @"$(f)";
file = File.new_for_path (file_name);
+ font_file_path = (!) file.get_path ();
if (!file.query_exists ()) {
save ();
} else {
@@ -75,10 +78,13 @@
}
f = BirdFont.get_current_font ();
-
- Preferences.add_recent_files (file_name);
- f.font_file = file_name;
-
+
+ if (font_file_path != "") {
+ f.font_file = font_file_path;
+ }
+
+ Preferences.add_recent_files (f.get_path ());
+
if (f.is_bfp ()) {
MainWindow.native_window.save ();
} else {
--- a/libbirdfont/SaveDialog.vala
+++ b/libbirdfont/SaveDialog.vala
@@ -56,7 +56,7 @@
height = 90 * MainWindow.units;
}
- void layout () {
+ public override void layout () {
double cx = 0;
double cy = (allocation.height - height) / 2.0;
double center;
--- a/libbirdfont/TabContent.vala
+++ b/libbirdfont/TabContent.vala
@@ -96,6 +96,7 @@
if (dialog.visible) {
dialog.allocation = allocation;
+ dialog.layout ();
dialog.draw (cr);
} else if (menu.show_menu) {
menu.draw (allocation, cr);
--- a/libbirdfont/Widget.vala
+++ b/libbirdfont/Widget.vala
@@ -41,6 +41,9 @@
cr.arc (x + radius, y + h, radius, 5 * (PI / 2), 6 * (PI / 2));
cr.line_to (x, y + radius);
cr.close_path ();
+ }
+
+ public virtual void layout () {
}
public bool is_over (double x, double y) {