Skip to content

Commit 8e6541c

Browse files
author
Kasper Peeters
committed
Fix layout sizing and a refresh bug on macOS.
1 parent 0b1a7d1 commit 8e6541c

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

frontend/gtkmm/ImageView.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void ImageView::set_image_from_base64(const std::string& b64)
7272
std::string dec=Glib::Base64::decode(b64);
7373
str->add_data(dec.c_str(), dec.size());
7474

75-
pixbuf = Gdk::Pixbuf::create_from_stream_at_scale(str,400,-1,true);
75+
pixbuf = Gdk::Pixbuf::create_from_stream_at_scale(str, 400, -1, true);
7676
if(!pixbuf)
7777
std::cerr << "cadabra-client: unable to create image from data" << std::endl;
7878
else {

frontend/gtkmm/NotebookWindow.cc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,9 @@ NotebookWindow::NotebookWindow(Cadabra *c, bool ro)
598598
topbox.pack_start(*pMenuBar, Gtk::PACK_SHRINK);
599599

600600
auto get_icon = [this](const std::string& nm) {
601-
Glib::RefPtr<Gdk::Pixbuf> pb = Gdk::Pixbuf::create_from_file(nm);
602-
pb = pb->scale_simple(50/scale, 50/scale, Gdk::INTERP_BILINEAR);
601+
Glib::RefPtr<Gio::File> ff = Gio::File::create_for_path(nm);
602+
Glib::RefPtr<Gio::FileInputStream> str = ff->read();
603+
Glib::RefPtr<Gdk::Pixbuf> pb = Gdk::Pixbuf::create_from_stream_at_scale(str, 50/scale, 50/scale, true);
603604
return pb;
604605
};
605606

@@ -640,7 +641,8 @@ NotebookWindow::NotebookWindow(Cadabra *c, bool ro)
640641
toolbar.pack_start(tool_restart, Gtk::PACK_SHRINK);
641642
toolbar.pack_start(top_label);
642643
toolbar.pack_end(kernel_spinner, Gtk::PACK_SHRINK);
643-
kernel_spinner.set_size_request(60/scale,60/scale);
644+
kernel_spinner.set_size_request(50/scale, 50/scale);
645+
kernel_spinner.set_margin_end(10/scale);
644646
}
645647

646648
// Normally we would use 'set_action_name' to associate the
@@ -1911,11 +1913,21 @@ void NotebookWindow::set_name(const std::string& n)
19111913

19121914
void NotebookWindow::load_file(const std::string& notebook_contents)
19131915
{
1916+
mainbox.set_sensitive(false);
1917+
19141918
load_from_string(notebook_contents);
19151919

19161920
mainbox.show_all();
19171921
modified=false;
19181922
update_title();
1923+
1924+
Glib::signal_idle().connect( sigc::mem_fun(*this, &NotebookWindow::on_first_redraw) );
1925+
}
1926+
1927+
bool NotebookWindow::on_first_redraw()
1928+
{
1929+
mainbox.set_sensitive(true);
1930+
return false;
19191931
}
19201932

19211933
void NotebookWindow::on_file_save()
@@ -2495,9 +2507,10 @@ void NotebookWindow::on_help_about()
24952507
about.set_logo(logo);
24962508
std::vector<Glib::ustring> special;
24972509
special.push_back("José M. Martín-García (for the xPerm canonicalisation code)");
2498-
special.push_back("Dominic Price (for the conversion to pybind and most of the Windows port)");
2510+
special.push_back("Dominic Price (for many additions, e.g. the conversion to pybind and the meld algorithm)");
24992511
special.push_back("Connor Behan (for various improvements related to index-free algorithms)");
25002512
special.push_back("James Allen (for writing much of the factoring code)");
2513+
special.push_back("NanoMichael (for the MicroTeX rendering library)");
25012514
special.push_back("Software Sustainability Institute");
25022515
special.push_back("Institute of Advanced Study (for a Christopherson/Knott fellowship)");
25032516
about.add_credit_section("Special thanks", special);

frontend/gtkmm/NotebookWindow.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ namespace cadabra {
210210
void on_file_export_python();
211211
void on_file_quit();
212212
bool quit_safeguard(bool quit);
213+
bool on_first_redraw();
213214

214215
void on_edit_undo();
215216
void on_edit_copy(const Glib::VariantBase&);

0 commit comments

Comments
 (0)