Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/UI/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,26 @@ public class Spreadsheet.UI.MainWindow : Gtk.ApplicationWindow {

Sheet? last_sheet = null;
foreach (var page in value.pages) {
var sheet = new Sheet (page, this);
var sheet = new Sheet (page);
foreach (var cell in page.cells) {
if (cell.selected) {
style_popup.child = new StyleModal (cell.font_style, cell.cell_style);
break;
}
}

foreach (var cell in page.cells) {
cell.notify["display-content"].connect (() => {
save_sheet ();
});
cell.font_style.notify.connect (() => {
save_sheet ();
});
cell.cell_style.notify.connect (() => {
save_sheet ();
});
}

sheet.selection_changed.connect ((cell) => {
if (cell != null) {
formula_entry.text = cell.formula;
Expand Down
7 changes: 1 addition & 6 deletions src/Widgets/Sheet.vala
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,14 @@ public class Spreadsheet.Widgets.Sheet : Gtk.DrawingArea {
private double padding;
private double border;

private MainWindow window;
private unowned ZoomManager zoom_manager;
private bool is_holding_ctrl = false;

public Sheet (Page page, MainWindow window) {
public Sheet (Page page) {
Object (
page: page
);

this.window = window;
zoom_manager = ZoomManager.get_default ();

focusable = true;
Expand All @@ -73,15 +71,12 @@ public class Spreadsheet.Widgets.Sheet : Gtk.DrawingArea {

cell.notify["display-content"].connect (() => {
queue_draw ();
window.save_sheet ();
});
cell.font_style.notify.connect (() => {
queue_draw ();
window.save_sheet ();
});
cell.cell_style.notify.connect (() => {
queue_draw ();
window.save_sheet ();
});
}

Expand Down