mirror of https://gitlab.com/nakst/essence
show dot on tabs with modified documents
This commit is contained in:
parent
622073ffb2
commit
5e62a5ab14
|
@ -4,6 +4,7 @@ icon=icon_system_file_manager
|
|||
permission_all_files=1
|
||||
permission_view_file_types=1
|
||||
use_single_process=1
|
||||
is_file_manager=1
|
||||
|
||||
[build]
|
||||
source=apps/file_manager/main.cpp
|
||||
|
|
|
@ -61,6 +61,7 @@ struct EnumString { const char *cName; int value; };
|
|||
#define DESKTOP_MSG_START_USER_TASK (16)
|
||||
#define DESKTOP_MSG_SET_PROGRESS (17)
|
||||
#define DESKTOP_MSG_RENAME (18)
|
||||
#define DESKTOP_MSG_SET_MODIFIED (19)
|
||||
|
||||
struct EsFileStore {
|
||||
#define FILE_STORE_HANDLE (1)
|
||||
|
@ -352,7 +353,8 @@ EsSystemConfigurationGroup *SystemConfigurationGetGroup(const char *section, ptr
|
|||
if (sectionBytes == -1) sectionBytes = EsCStringLength(section);
|
||||
|
||||
for (uintptr_t i = 0; i < api.systemConfigurationGroups.Length(); i++) {
|
||||
if (0 == EsStringCompareRaw(section, sectionBytes, api.systemConfigurationGroups[i].section, api.systemConfigurationGroups[i].sectionBytes)) {
|
||||
if (0 == EsStringCompareRaw(section, sectionBytes, api.systemConfigurationGroups[i].section, api.systemConfigurationGroups[i].sectionBytes)
|
||||
&& !api.systemConfigurationGroups[i].sectionClassBytes) {
|
||||
return &api.systemConfigurationGroups[i];
|
||||
}
|
||||
}
|
||||
|
@ -1201,6 +1203,15 @@ EsMessage *EsMessageReceive() {
|
|||
}
|
||||
}
|
||||
|
||||
void InstanceSetModified(EsInstance *instance, bool modified) {
|
||||
EsCommandSetEnabled(EsCommandByID(instance, ES_COMMAND_SAVE), modified);
|
||||
|
||||
uint8_t m[2];
|
||||
m[0] = DESKTOP_MSG_SET_MODIFIED;
|
||||
m[1] = modified;
|
||||
MessageDesktop(m, 2, instance->window->handle);
|
||||
}
|
||||
|
||||
void EsInstanceOpenComplete(EsMessage *message, bool success, const char *errorText, ptrdiff_t errorTextBytes) {
|
||||
EsInstance *instance = message->instanceOpen.instance;
|
||||
|
||||
|
@ -1234,7 +1245,7 @@ void EsInstanceOpenComplete(EsMessage *message, bool success, const char *errorT
|
|||
EsUndoClear(instance->undoManager);
|
||||
}
|
||||
|
||||
EsCommandSetDisabled(EsCommandByID(instance, ES_COMMAND_SAVE), true);
|
||||
InstanceSetModified(instance, false);
|
||||
}
|
||||
|
||||
EsAssert(!message->instanceOpen.file->operationComplete);
|
||||
|
@ -1263,7 +1274,7 @@ void EsInstanceSaveComplete(EsMessage *message, bool success) {
|
|||
MessageDesktop(buffer, 1, instance->window->handle);
|
||||
|
||||
if (success) {
|
||||
EsCommandSetDisabled(EsCommandByID(instance, ES_COMMAND_SAVE), true);
|
||||
InstanceSetModified(instance, false);
|
||||
EsRectangle bounds = EsElementGetWindowBounds(instance->window->toolbarSwitcher);
|
||||
size_t messageBytes;
|
||||
char *message = EsStringAllocateAndFormat(&messageBytes, "Saved to %s", // TODO Localization.
|
||||
|
@ -1377,7 +1388,7 @@ extern "C" void _start(EsProcessStartupInformation *_startupInformation) {
|
|||
_EsNodeInformation node;
|
||||
char *path;
|
||||
|
||||
path = EsSystemConfigurationReadString(EsLiteral("general"), EsLiteral("fonts_path"));
|
||||
path = EsSystemConfigurationReadString(EsLiteral("paths"), EsLiteral("fonts"));
|
||||
NodeOpen(path, EsCStringLength(path), ES_NODE_DIRECTORY, &node);
|
||||
NodeAddMountPoint(EsLiteral("|Fonts:"), node.handle, false);
|
||||
EsHeapFree(path);
|
||||
|
@ -1644,7 +1655,7 @@ void EsUndoPush(EsUndoManager *manager, EsUndoCallback callback, const void *ite
|
|||
EsCommandSetDisabled(EsCommandByID(manager->instance, ES_COMMAND_REDO), !manager->redoStack.Length());
|
||||
|
||||
if (manager->instance->undoManager == manager) {
|
||||
EsCommandSetDisabled(EsCommandByID(manager->instance, ES_COMMAND_SAVE), false);
|
||||
InstanceSetModified(manager->instance, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1921,7 +1921,7 @@ EsError TemporaryFileCreate(EsHandle *handle, char **path, size_t *pathBytes, ui
|
|||
}
|
||||
|
||||
size_t temporaryFolderBytes;
|
||||
char *temporaryFolder = EsSystemConfigurationReadString(EsLiteral("general"), EsLiteral("temporary_path"), &temporaryFolderBytes);
|
||||
char *temporaryFolder = EsSystemConfigurationReadString(EsLiteral("paths"), EsLiteral("temporary"), &temporaryFolderBytes);
|
||||
char *temporaryFilePath = (char *) EsHeapAllocate(temporaryFolderBytes + 1 + sizeof(temporaryFileName), false);
|
||||
size_t temporaryFilePathBytes = EsStringFormat(temporaryFilePath, ES_STRING_FORMAT_ENOUGH_SPACE, "%s/%s",
|
||||
temporaryFolderBytes, temporaryFolder, sizeof(temporaryFileName), temporaryFileName);
|
||||
|
@ -1951,7 +1951,7 @@ void ApplicationInstanceRequestSave(ApplicationInstance *instance, const char *n
|
|||
|
||||
if (!instance->documentID) {
|
||||
size_t folderBytes;
|
||||
char *folder = EsSystemConfigurationReadString(EsLiteral("general"), EsLiteral("default_user_documents_path"), &folderBytes);
|
||||
char *folder = EsSystemConfigurationReadString(EsLiteral("paths"), EsLiteral("default_user_documents"), &folderBytes);
|
||||
char *name = (char *) EsHeapAllocate(folderBytes + newNameBytes + 32, false);
|
||||
EsMemoryCopy(name, folder, folderBytes);
|
||||
EsMemoryCopy(name + folderBytes, newName, newNameBytes);
|
||||
|
@ -2357,14 +2357,15 @@ void CheckForegroundWindowResponding(EsGeneric) {
|
|||
}
|
||||
|
||||
void DesktopSetup() {
|
||||
// Get the installation state.
|
||||
|
||||
if (!desktop.setupDesktopUIComplete) {
|
||||
// Get the installation state.
|
||||
desktop.installationState = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("installation_state"));
|
||||
}
|
||||
|
||||
if (!desktop.setupDesktopUIComplete) {
|
||||
// Load the theme bitmap.
|
||||
// Load the theme bitmap.
|
||||
|
||||
if (!desktop.setupDesktopUIComplete) {
|
||||
EsHandle handle = EsMemoryOpen(ES_THEME_CURSORS_WIDTH * ES_THEME_CURSORS_HEIGHT * 4, EsLiteral(ES_THEME_CURSORS_NAME), ES_FLAGS_DEFAULT);
|
||||
void *destination = EsObjectMap(handle, 0, ES_THEME_CURSORS_WIDTH * ES_THEME_CURSORS_HEIGHT * 4, ES_MAP_OBJECT_READ_WRITE);
|
||||
LoadImage(theming.system.in + theming.system.bytes - theming.header->bitmapBytes, theming.header->bitmapBytes,
|
||||
|
@ -2373,9 +2374,9 @@ void DesktopSetup() {
|
|||
EsHandleClose(handle);
|
||||
}
|
||||
|
||||
{
|
||||
// Create the wallpaper window.
|
||||
// Create the wallpaper window.
|
||||
|
||||
{
|
||||
if (!desktop.wallpaperWindow) desktop.wallpaperWindow = EsWindowCreate(nullptr, ES_WINDOW_PLAIN);
|
||||
EsRectangle screen;
|
||||
EsSyscall(ES_SYSCALL_SCREEN_BOUNDS_GET, 0, (uintptr_t) &screen, 0, 0);
|
||||
|
@ -2459,6 +2460,8 @@ void DesktopSetup() {
|
|||
EsHeapFree(firstApplication);
|
||||
}
|
||||
} else if (desktop.installationState == INSTALLATION_STATE_INSTALLER) {
|
||||
// Start the instller.
|
||||
|
||||
if (!desktop.setupDesktopUIComplete) {
|
||||
ApplicationInstanceCreate(desktop.installer->id, nullptr, nullptr, true /* hidden */);
|
||||
}
|
||||
|
@ -2549,8 +2552,14 @@ void DesktopSyscall(EsMessage *message, uint8_t *buffer, EsBuffer *pipe) {
|
|||
EsHandleClose(processHandle);
|
||||
}
|
||||
} else if (buffer[0] == DESKTOP_MSG_SYSTEM_CONFIGURATION_GET && pipe) {
|
||||
InstalledApplication *application = ApplicationFindByPID(message->desktop.processID);
|
||||
|
||||
ConfigurationWriteSectionsToBuffer("font", nullptr, false, pipe);
|
||||
ConfigurationWriteSectionsToBuffer(nullptr, "ui", false, pipe);
|
||||
|
||||
if (application && (application->permissions & APPLICATION_PERMISSION_ALL_FILES)) {
|
||||
ConfigurationWriteSectionsToBuffer(nullptr, "paths", false, pipe);
|
||||
}
|
||||
} else if (buffer[0] == DESKTOP_MSG_REQUEST_SHUTDOWN) {
|
||||
InstalledApplication *application = ApplicationFindByPID(message->desktop.processID);
|
||||
|
||||
|
@ -2648,6 +2657,10 @@ void DesktopSyscall(EsMessage *message, uint8_t *buffer, EsBuffer *pipe) {
|
|||
instance->tab->container->taskBarButton->Repaint(true);
|
||||
}
|
||||
}
|
||||
} else if (buffer[0] == DESKTOP_MSG_SET_MODIFIED && message->desktop.bytes == 2) {
|
||||
if (instance->tab) {
|
||||
EsButtonSetCheck(instance->tab->closeButton, buffer[1] ? ES_CHECK_CHECKED : ES_CHECK_UNCHECKED, false);
|
||||
}
|
||||
} else if (buffer[0] == DESKTOP_MSG_SET_PROGRESS && message->desktop.bytes == 1 + sizeof(double) && instance->isUserTask) {
|
||||
double progress;
|
||||
EsMemoryCopy(&progress, buffer + 1, sizeof(double));
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
[general]
|
||||
fonts_path=0:/Essence/Fonts
|
||||
temporary_path=0:/Essence/Temporary
|
||||
default_settings_path=0:/Essence/Settings
|
||||
default_user_documents_path=0:/
|
||||
click_chain_timeout_ms=500
|
||||
show_cursor_shadow=1
|
||||
scroll_lines_per_notch=3
|
||||
|
@ -11,6 +7,12 @@ window_color=6
|
|||
use_smart_quotes=1
|
||||
enable_hover_state=1
|
||||
|
||||
[paths]
|
||||
fonts=0:/Essence/Fonts
|
||||
temporary=0:/Essence/Temporary
|
||||
default_settings=0:/Essence/Settings
|
||||
default_user_documents=0:/
|
||||
|
||||
[ui]
|
||||
font_fallback=Inter
|
||||
font_sans=Inter
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -821,7 +821,6 @@ void OutputSystemConfiguration() {
|
|||
FilePrintFormat(file, "name=%s\n", applications[i].name);
|
||||
FilePrintFormat(file, "executable=0:/Applications/%s.esx\n", applications[i].name);
|
||||
FilePrintFormat(file, "settings_path=0:/Essence/Settings/%s\n", applications[i].name);
|
||||
FilePrintFormat(file, "is_file_manager=%d\n", 0 == strcmp(applications[i].name, "File Manager") ? 1 : 0);
|
||||
|
||||
for (uintptr_t j = 0; j < arrlenu(applications[i].properties); j++) {
|
||||
FilePrintFormat(file, "%s=%s\n", applications[i].properties[j].key, applications[i].properties[j].value);
|
||||
|
|
Loading…
Reference in New Issue