Units that cannot be executed are shown in red on both the Units and Plans tabs. Validation checks target existence/executability, shell definition lookup, working directory existence, rectifier existence/executability, and environment file existence. The unit properties dialog applies live validation with GTK error styling on each field and reports issues to the status bar as the user edits. Selecting a unit or task re-runs validation so the status bar always reflects the selected item. Also separates plan dirty state from unit editor dirty state so editing unit properties no longer marks the plan as unsaved.
82 lines
2.8 KiB
C++
82 lines
2.8 KiB
C++
/*
|
|
GREX - A graphical frontend for creating and managing Rex project files.
|
|
Copyright (C) 2026 SILO GROUP, LLC. Written by Chris Punches
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as
|
|
published by the Free Software Foundation, either version 3 of the
|
|
License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
#include <gtk/gtk.h>
|
|
#include "models/project.h"
|
|
#include "models/grex_config.h"
|
|
|
|
namespace grex {
|
|
|
|
class UnitEditor;
|
|
|
|
class PlanView {
|
|
public:
|
|
PlanView(Project& project, GrexConfig& grex_config);
|
|
GtkWidget* widget() { return root_; }
|
|
void refresh();
|
|
void reload_plan_from_disk();
|
|
bool is_dirty() const;
|
|
void save_dirty();
|
|
void revert_dirty();
|
|
|
|
private:
|
|
Project& project_;
|
|
GrexConfig& grex_config_;
|
|
GtkWidget* root_;
|
|
GtkWidget* plan_label_;
|
|
GtkWidget* task_listbox_;
|
|
GtkWidget* btn_open_plan_;
|
|
GtkWidget* btn_create_plan_;
|
|
GtkWidget* btn_close_plan_;
|
|
GtkWidget* btn_save_plan_;
|
|
GtkWidget* task_controls_; // container for task list + buttons
|
|
GtkWidget* task_ctrl_frame_; // Task Controls frame in right panel
|
|
GtkWidget* btn_move_up_;
|
|
GtkWidget* btn_move_down_;
|
|
UnitEditor* unit_editor_;
|
|
|
|
int current_task_idx_ = -1;
|
|
bool plan_dirty_ = false;
|
|
bool suppress_selection_ = false;
|
|
|
|
void populate_task_list();
|
|
void select_task(int idx);
|
|
|
|
Plan* current_plan();
|
|
|
|
static void on_open_plan(GtkButton* btn, gpointer data);
|
|
static void on_open_plan_response(GObject* source, GAsyncResult* res, gpointer data);
|
|
static void on_task_selected(GtkListBox* box, GtkListBoxRow* row, gpointer data);
|
|
static void on_add_task(GtkButton* btn, gpointer data);
|
|
static void on_delete_task(GtkButton* btn, gpointer data);
|
|
static void on_move_up(GtkButton* btn, gpointer data);
|
|
static void on_move_down(GtkButton* btn, gpointer data);
|
|
static void on_close_plan(GtkButton* btn, gpointer data);
|
|
static void on_delete_plan(GtkButton* btn, gpointer data);
|
|
static void on_create_plan(GtkButton* btn, gpointer data);
|
|
static void on_create_plan_response(GObject* source, GAsyncResult* res, gpointer data);
|
|
|
|
void refresh_task_row(int idx);
|
|
void update_plan_buttons();
|
|
void update_move_buttons();
|
|
void close_plan_impl();
|
|
};
|
|
|
|
}
|