a36530bb6f
- Dockspace host (PassthruCentralNode) bajo la toolbar para que las
ventanas Viewport/Legend/Inspector/Stats puedan dockearse dentro de la
app principal.
- Toolbar: input "Add node" con auto-deteccion de tipo (text/email/
ip_address/url/domain/phone). Insert en operations.db + reload.
- Context menu (right-click sobre nodo): Change type, Duplicate, Delete,
submenu "Run enricher" (placeholder hasta issues 0001-0003).
- Inspector: vecinos ahora muestran etiqueta de relacion ("-> employs",
"<- owns") usando rel_types[].name como label de arista.
- Default relation label k_default_relation_name="RELATED_TO" para
relaciones creadas sin nombre semantico explicito.
- Indice EntityIndex (FNV1a hash -> sql id) reconstruido tras cada load
para resolver mutaciones desde el grafo en memoria.
Issues planteadas para iteraciones siguientes:
- 0001: chat con Claude sobre el grafo (HTTP + tool-use)
- 0002: enricher GLiNER+GLiREL desde nodo texto
- 0003: enricher web (fetch URL/dominio + extract text)
- 0004: vista tabla por tipo de entidad
101 lines
3.8 KiB
C++
101 lines
3.8 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
struct GraphData;
|
|
struct GraphViewportState;
|
|
|
|
namespace ge {
|
|
|
|
// Estado compartido entre las vistas y el bucle render. Pasado por puntero
|
|
// desde main.cpp.
|
|
struct AppState {
|
|
// Datos
|
|
GraphData* graph = nullptr;
|
|
GraphViewportState* viewport = nullptr;
|
|
|
|
// Layout activo
|
|
int layout_mode = 0; // 0=force, 1=grid, 2=circular, 3=radial, 4=hierarchical, 5=fixed
|
|
int apply_layout_tick = 0; // se incrementa cuando hay que reaplicar layout
|
|
|
|
// Force layout — config + GPU toggle
|
|
float repulsion = 1500.0f;
|
|
float attraction = 0.04f;
|
|
float gravity = 0.005f;
|
|
bool use_gpu = false;
|
|
|
|
// Stats UI
|
|
int fps_estimate = 0; // sintetico, calculado en main loop
|
|
|
|
// Filters / visibility por tipo (longitud = graph->type_count o rel_type_count)
|
|
bool type_visible[256] = {};
|
|
bool rel_type_visible[256] = {};
|
|
int type_visible_n = 0;
|
|
int rel_type_visible_n = 0;
|
|
|
|
// Inspector
|
|
bool panel_legend = true;
|
|
bool panel_inspector = true;
|
|
bool panel_stats = true;
|
|
bool panel_viewport = true;
|
|
bool show_filters_modal = false;
|
|
bool show_open_modal = false;
|
|
|
|
// Triggers — main.cpp lee estos flags y actua
|
|
bool want_fit = false;
|
|
bool want_save_layout = false;
|
|
bool want_reload = false;
|
|
bool want_open_file = false; // marcado al confirmar el modal Open
|
|
char open_buf[512] = {};
|
|
|
|
// Labels overlay
|
|
bool labels_enabled = true;
|
|
|
|
// Path activo de operations.db (para CRUD desde toolbar / contextmenu).
|
|
// main.cpp lo escribe tras cargar y los handlers lo leen.
|
|
std::string input_db_path;
|
|
|
|
// Add-node toolbar input.
|
|
char add_buf[256] = {};
|
|
|
|
// Triggers de mutacion — main.cpp los procesa y dispara reload.
|
|
bool want_add_node = false; // commit del input add_buf
|
|
bool want_delete_node = false; // delete del nodo en ctx_node
|
|
bool want_duplicate_node = false;
|
|
bool want_change_type = false; // a ctx_new_type
|
|
int ctx_node = -1; // node_idx objetivo
|
|
char ctx_new_type[64] = {};
|
|
|
|
// Context menu state — popup global identificado por nombre.
|
|
bool ctx_open_request = false; // se setea en on_context_menu
|
|
};
|
|
|
|
// Toolbar superior (Open file, Layout selector, Filters..., Fit, Save layout).
|
|
void views_toolbar(AppState& app);
|
|
|
|
// Panel Legend — checkboxes por tipo (entity / relation) con color swatch.
|
|
void views_legend(AppState& app);
|
|
|
|
// Panel Inspector — metadata del nodo seleccionado + vecinos.
|
|
void views_inspector(AppState& app);
|
|
|
|
// Stats line — counts + fps + energy + selection.
|
|
void views_stats(AppState& app);
|
|
|
|
// Modal Filters — toggles por tipo agrupados en columnas. Devuelve true si
|
|
// el usuario togglo algo.
|
|
bool views_filters_modal(AppState& app);
|
|
|
|
// Modal Open file — text input + boton Open.
|
|
bool views_open_modal(AppState& app);
|
|
|
|
// Refresca los flags `flags` de cada nodo/arista segun el array
|
|
// `type_visible[]` / `rel_type_visible[]`. Lineal en N+M.
|
|
void views_apply_visibility(AppState& app);
|
|
|
|
// Inicializa los arrays type_visible / rel_type_visible a true para todos
|
|
// los tipos del grafo activo. Llamar tras cargar/recargar el grafo.
|
|
void views_reset_visibility(AppState& app);
|
|
|
|
} // namespace ge
|