diff --git a/CMakeLists.txt b/CMakeLists.txt
index 104b8a8..87fecd8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.17)
-project(PretextView VERSION "1.0.5")
+project(PretextView VERSION "1.0.6")
option(FORCE_MAC_X86 "Force macOS x86_64 build" OFF)
diff --git a/Info.plist b/Info.plist
index f6fa185..b1fbc1d 100644
--- a/Info.plist
+++ b/Info.plist
@@ -13,7 +13,7 @@
CFBundleIconFile
icon.icns
CFBundleShortVersionString
- 1.0.5
+ 1.0.6
CFBundleInfoDictionaryVersion
6.0
CFBundlePackageType
diff --git a/PretextView.cpp b/PretextView.cpp
index ac59b49..88d0258 100644
--- a/PretextView.cpp
+++ b/PretextView.cpp
@@ -1107,6 +1107,11 @@ global_variable auto auto_curation_state = AutoCurationState();
global_function void
UserSaveState(const char *headerHash = "userprofile", u08 overwrite = 1, char *path = 0);
+global_function void
+CopyHighlightedRegionToClipboard(GLFWwindow *window);
+
+global_variable f64 CopyToast_Time = 0.0;
+
global_variable
u08
@@ -1209,6 +1214,7 @@ struct file_browser saveBrowser;
struct file_browser loadBrowser;
struct file_browser saveAGPBrowser;
struct file_browser saveEditsBrowser;
+struct file_browser saveClipboardBrowser;
struct file_browser loadAGPBrowser;
@@ -1547,6 +1553,10 @@ global_variable
char
Edits_Name_Buffer[1024] = {0};
+global_variable
+char
+Clipboard_Save_Name_Buffer[1024] = "clipboard.txt";
+
global_function
void
SetSaveStateNameBuffer(char *name)
@@ -1556,7 +1566,9 @@ SetSaveStateNameBuffer(char *name)
{
AGP_Name_Buffer[ptr] = *name;
Edits_Name_Buffer[ptr] = *name;
- Save_State_Name_Buffer[ptr++] = *name++;
+ Save_State_Name_Buffer[ptr] = *name;
+ ptr++;
+ name++;
}
u32 ptr1 = ptr;
@@ -1573,6 +1585,12 @@ SetSaveStateNameBuffer(char *name)
name = (char *)"_edits.txt";
while (*name) Edits_Name_Buffer[ptr++] = *name++;
Edits_Name_Buffer[ptr] = 0;
+
+ ptr = ptr1;
+ name = (char *)"_clipboard.txt";
+ while (*name) Clipboard_Save_Name_Buffer[ptr++] = *name++;
+ Clipboard_Save_Name_Buffer[ptr] = 0;
+
}
@@ -1582,6 +1600,7 @@ SetSaveStateNameBuffer(char *name)
1 save state
2 agp state
3 edits save
+ 4 clipboard save
*/
global_function
u08
@@ -1725,7 +1744,7 @@ FileBrowserRun(const char *name, struct file_browser *browser, struct nk_context
{
if (save)
{
- char *nameBuffer = save == 2 ? AGP_Name_Buffer : (save == 3 ? Edits_Name_Buffer : Save_State_Name_Buffer);
+ char *nameBuffer = save == 2 ? AGP_Name_Buffer : (save == 3 ? Edits_Name_Buffer : (save == 4 ? Clipboard_Save_Name_Buffer : Save_State_Name_Buffer));
strncpy(nameBuffer, browser->files[fileIndex], 1024);
}
else
@@ -1768,7 +1787,7 @@ FileBrowserRun(const char *name, struct file_browser *browser, struct nk_context
f32 fileRatio2[] = {0.45f, 0.1f, 0.18f, 0.17f, NK_UNDEFINED};
nk_layout_row(ctx, NK_DYNAMIC, Screen_Scale.y * 35.0f, save == 2 ? 5 : 3, save == 2 ? fileRatio2 : fileRatio);
- char *nameBuffer = save == 2 ? AGP_Name_Buffer : (save == 3 ? Edits_Name_Buffer : Save_State_Name_Buffer);
+ char *nameBuffer = save == 2 ? AGP_Name_Buffer : (save == 3 ? Edits_Name_Buffer : (save == 4 ? Clipboard_Save_Name_Buffer : Save_State_Name_Buffer));
u08 saveViaEnter = (nk_edit_string_zero_terminated(ctx, NK_EDIT_FIELD | NK_EDIT_SIG_ENTER, nameBuffer, 1024, 0) & NK_EDIT_COMMITED) ? 1 : 0;
static u08 overwrite = 0;
@@ -1783,7 +1802,7 @@ FileBrowserRun(const char *name, struct file_browser *browser, struct nk_context
{
strncpy(browser->file, browser->directory, MAX_PATH_LEN);
size_t n = strlen(browser->file);
- char *nameBuffer = save == 2 ? AGP_Name_Buffer : (save == 3 ? Edits_Name_Buffer : Save_State_Name_Buffer);
+ char *nameBuffer = save == 2 ? AGP_Name_Buffer : (save == 3 ? Edits_Name_Buffer : (save == 4 ? Clipboard_Save_Name_Buffer : Save_State_Name_Buffer));
strncpy(browser->file + n, nameBuffer, MAX_PATH_LEN - n);
ret = 1 | (overwrite ? 2 : 0) | (singletons ? 4 : 0) | (preserveOrder ? 8 : 0);
}
@@ -1799,6 +1818,106 @@ FileBrowserRun(const char *name, struct file_browser *browser, struct nk_context
return(ret);
}
+#define ClipboardEditorBufferSize 32768
+#define ClipboardEditorLastCopiedSize 4096
+
+/* clipboard editor, highlight, copy and paste */
+global_variable char ClipboardEditor_LastCopied[ClipboardEditorLastCopiedSize] = {0};
+global_variable char ClipboardEditor_Buffer[ClipboardEditorBufferSize] = {0};
+global_variable u08 ClipboardEditor_Window_Open = 0;
+
+static void nk_clipboard_paste(nk_handle ud, struct nk_text_edit *edit)
+{
+ GLFWwindow *win = (GLFWwindow *)ud.ptr;
+ const char *text = win ? glfwGetClipboardString(win) : 0;
+ if (text) nk_textedit_paste(edit, text, nk_strlen(text));
+}
+static void nk_clipboard_copy(nk_handle ud, const char *text, int len)
+{
+ GLFWwindow *win = (GLFWwindow *)ud.ptr;
+ if (!win) return;
+ char *buf = (char *)malloc((size_t)len + 1);
+ if (buf) { memcpy(buf, text, (size_t)len); buf[len] = 0; glfwSetClipboardString(win, buf); free(buf); }
+}
+
+global_function
+/* save clipboard to file */
+void
+SaveClipboardToFile(char *path, u08 overwrite)
+{
+ FILE *file;
+ if (!overwrite && (file = fopen((const char *)path, "rb")))
+ {
+ fclose(file);
+ return;
+ }
+ if ((file = fopen((const char *)path, "w")))
+ {
+ fputs(ClipboardEditor_Buffer, file);
+ fclose(file);
+ }
+}
+
+global_function
+void
+ClipboardEditorRun(struct nk_context *ctx, u08 show, GLFWwindow *glfwWin, s32 *showSaveClipboardScreen, s32 *saveAsClicked)
+{
+ const char *name = "Clipboard Editor";
+ struct nk_window *window = nk_window_find(ctx, name);
+
+ u08 doesExist = window != 0;
+ if (!show && !doesExist) { ClipboardEditor_Window_Open = 0; return; }
+ if (show && doesExist && (window->flags & NK_WINDOW_HIDDEN)) window->flags &= ~(nk_flags)NK_WINDOW_HIDDEN;
+
+ if (nk_begin(ctx, name, nk_rect(Screen_Scale.x * 100, Screen_Scale.y * 80, Screen_Scale.x * 600, Screen_Scale.y * 450),
+ NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_CLOSABLE | NK_WINDOW_TITLE | NK_WINDOW_SCALABLE))
+ {
+ ClipboardEditor_Window_Open = 1;
+ static u08 loadedOnce = 0;
+
+ if (show && !loadedOnce)
+ {
+ loadedOnce = 1;
+ if (ClipboardEditor_LastCopied[0])
+ {
+ size_t len = strlen(ClipboardEditor_LastCopied);
+ if (len >= ClipboardEditorBufferSize) len = ClipboardEditorBufferSize - 1;
+ memcpy(ClipboardEditor_Buffer, ClipboardEditor_LastCopied, len);
+ ClipboardEditor_Buffer[len] = '\0';
+ }
+ else
+ {
+ const char *clip = glfwWin ? glfwGetClipboardString(glfwWin) : 0;
+ if (clip)
+ {
+ size_t len = strlen(clip);
+ if (len >= ClipboardEditorBufferSize) len = ClipboardEditorBufferSize - 1;
+ memcpy(ClipboardEditor_Buffer, clip, len);
+ ClipboardEditor_Buffer[len] = '\0';
+ }
+ else ClipboardEditor_Buffer[0] = '\0';
+ }
+ }
+ if (!show) loadedOnce = 0;
+
+ /* Edit box first so it gets focus by default; Save as below to avoid accidental activation */
+ nk_layout_row_dynamic(ctx, Screen_Scale.y * 350.0f, 1);
+ nk_edit_string_zero_terminated(ctx, NK_EDIT_BOX | NK_EDIT_CLIPBOARD, ClipboardEditor_Buffer, ClipboardEditorBufferSize - 1, 0);
+
+ nk_layout_row_dynamic(ctx, Screen_Scale.y * 28.0f, 1);
+ if (nk_button_label(ctx, "Save as") && showSaveClipboardScreen && saveAsClicked)
+ {
+ *showSaveClipboardScreen = 1;
+ *saveAsClicked = 1;
+ }
+ }
+ else
+ {
+ ClipboardEditor_Window_Open = 0;
+ }
+ nk_end(ctx);
+}
+
global_function
void
MetaTagsEditorRun(struct nk_context *ctx, u08 show)
@@ -6025,6 +6144,24 @@ Render() {
ChangeSize((s32)width, (s32)height);
}
+
+ if (CopyToast_Time > 0.0 && (GetTime() - CopyToast_Time) < 2.0)
+ {
+ u32 colour = glfonsRGBA(Theme_Colour.r, Theme_Colour.g, Theme_Colour.b, Theme_Colour.a);
+
+ fonsClearState(FontStash_Context);
+ fonsSetSize(FontStash_Context, 32.0f * Screen_Scale.x);
+ fonsSetAlign(FontStash_Context, FONS_ALIGN_CENTER | FONS_ALIGN_MIDDLE);
+ fonsSetFont(FontStash_Context, Font_Normal);
+ fonsSetColor(FontStash_Context, colour);
+
+ glUseProgram(UI_Shader->shaderProgram);
+ glUniformMatrix4fv(Flat_Shader->matLocation, 1, GL_FALSE, textNormalMat);
+ glViewport(0, 0, (s32)width, (s32)height);
+ fonsDrawText(FontStash_Context, width * 0.5f, height * 0.15f, "Copied to clipboard", 0);
+
+ ChangeSize((s32)width, (s32)height);
+ }
}
}
@@ -9584,6 +9721,11 @@ KeyBoard(GLFWwindow* window, s32 key, s32 scancode, s32 action, s32 mods)
break;
case GLFW_KEY_P:
+ if (Edit_Mode)
+ {
+ CopyHighlightedRegionToClipboard(window);
+ keyPressed = 1;
+ }
break;
case GLFW_KEY_Q:
@@ -12006,7 +12148,7 @@ UserSaveState(const char *headerHash, u08 overwrite , char *path)
// finished (shaoheng) save default file browser directory
const char* placeholder = "fdpc"; // placeholder for File Directory Path Cache
for (int i = 0; i < 4; i ++ ) fwrite(&placeholder[i], sizeof(char), 1, file);
- for (const file_browser& browser_tmp : { browser, saveBrowser, loadBrowser, saveAGPBrowser, saveEditsBrowser, loadAGPBrowser }) {
+ for (const file_browser& browser_tmp : { browser, saveBrowser, loadBrowser, saveAGPBrowser, saveEditsBrowser, saveClipboardBrowser, loadAGPBrowser }) {
if (browser_tmp.directory[0]!='\0') {
u32 dir_len = strlen(browser_tmp.directory);
fwrite(&dir_len, sizeof(dir_len), 1, file);
@@ -12170,7 +12312,7 @@ global_function
// file directory path cache
char lable[4];
if (fread(lable, sizeof(char), 4, file) == 4 && strncmp(lable, "fdpc", 4) == 0) {
- std::vector browsers = { &browser, &saveBrowser, &loadBrowser, &saveAGPBrowser, &saveEditsBrowser, &loadAGPBrowser };
+ std::vector browsers = { &browser, &saveBrowser, &loadBrowser, &saveAGPBrowser, &saveEditsBrowser, &saveClipboardBrowser, &loadAGPBrowser };
for (file_browser* browser_ptr : browsers) {
u32 dir_len;
if (fread(&dir_len, sizeof(dir_len), 1, file) == 1 && dir_len > 0) {
@@ -12218,6 +12360,109 @@ TextInput(GLFWwindow* window, u32 codepoint)
}
}
+global_function
+void
+CopyHighlightedRegionToClipboard(GLFWwindow *window)
+{
+ if (!File_Loaded || !Map_State || !Original_Contigs || !Number_of_Pixels_1D) return;
+
+ u32 pixelStart, pixelEnd;
+ if (Edit_Pixels.editing)
+ {
+ pixelStart = my_Min(Edit_Pixels.pixels.x, Edit_Pixels.pixels.y);
+ pixelEnd = my_Max(Edit_Pixels.pixels.x, Edit_Pixels.pixels.y);
+ }
+ else if (Edit_Pixels.selecting)
+ {
+ pixelStart = my_Min(Edit_Pixels.selectPixels.x, Edit_Pixels.selectPixels.y);
+ pixelEnd = my_Max(Edit_Pixels.selectPixels.x, Edit_Pixels.selectPixels.y);
+ }
+ else
+ {
+ /* Use current cursor position when no explicit selection */
+ pixelStart = my_Min(Edit_Pixels.pixels.x, Edit_Pixels.pixels.y);
+ pixelEnd = my_Max(Edit_Pixels.pixels.x, Edit_Pixels.pixels.y);
+ }
+
+ pixelStart = my_Min(pixelStart, Number_of_Pixels_1D - 1);
+ pixelEnd = my_Min(pixelEnd, Number_of_Pixels_1D - 1);
+
+ /* Map pixels are uniform in bp along the whole map; contigRelCoords are local indices along each
+ fragment. Convert selection to bp along the fragment using startCoord and inversion (not rel * global bp). */
+ f64 bp_per_map_pixel = (f64)Total_Genome_Length / (f64)Number_of_Pixels_1D;
+
+ char buffer[1024];
+ u32 bufPtr = 0;
+
+ for (u32 p = pixelStart; p <= pixelEnd; )
+ {
+ u32 fragId = Map_State->contigIds[p];
+ u32 baseId = GetOriginalContigBaseId(Map_State->originalContigIds[p]);
+ u32 minRel = Map_State->contigRelCoords[p];
+ u32 maxRel = Map_State->contigRelCoords[p];
+ u32 q = p + 1;
+ while (q <= pixelEnd && Map_State->contigIds[q] == fragId)
+ {
+ u32 r = Map_State->contigRelCoords[q];
+ if (r < minRel) minRel = r;
+ if (r > maxRel) maxRel = r;
+ ++q;
+ }
+ p = q;
+
+ if (fragId >= Contigs->numberOfContigs) continue;
+
+ contig *c = Contigs->contigs_arr + fragId;
+ f64 startMbp;
+ f64 endMbp;
+ if (!IsContigInverted(fragId))
+ {
+ startMbp = ((f64)(minRel - c->startCoord) * bp_per_map_pixel) / 1e6;
+ endMbp = ((f64)(maxRel - c->startCoord + 1u) * bp_per_map_pixel) / 1e6;
+ }
+ else
+ {
+ startMbp = ((f64)(c->startCoord - maxRel) * bp_per_map_pixel) / 1e6;
+ endMbp = ((f64)(c->startCoord - minRel + 1u) * bp_per_map_pixel) / 1e6;
+ }
+ if (startMbp < 0.0) startMbp = 0.0;
+ if (endMbp < 0.0) endMbp = 0.0;
+
+ const char *name = (const char *)(Original_Contigs + baseId)->name;
+ bufPtr += (u32)stbsp_snprintf(buffer + bufPtr, (s32)(sizeof(buffer) - bufPtr), "%s%s %.2f Mbp - %.2f Mbp",
+ bufPtr ? "; " : "", name, startMbp, endMbp);
+ }
+ glfwSetClipboardString(window, buffer);
+ size_t len = strlen(buffer);
+ /* Append to ClipboardEditor_LastCopied instead of overwriting */
+ size_t lastLen = strlen(ClipboardEditor_LastCopied);
+ if (lastLen > 0 && lastLen < ClipboardEditorLastCopiedSize - 2)
+ {
+ ClipboardEditor_LastCopied[lastLen] = '\n';
+ lastLen++;
+ }
+ size_t copyLen = len;
+ if (lastLen + copyLen >= ClipboardEditorLastCopiedSize) copyLen = ClipboardEditorLastCopiedSize - lastLen - 1;
+ memcpy(ClipboardEditor_LastCopied + lastLen, buffer, copyLen + 1);
+ ClipboardEditor_LastCopied[lastLen + copyLen] = '\0';
+ /* If Clipboard Editor is open, append to its buffer too */
+ if (ClipboardEditor_Window_Open)
+ {
+ size_t bufLen = strlen(ClipboardEditor_Buffer);
+ if (bufLen > 0 && bufLen < ClipboardEditorBufferSize - 2)
+ {
+ ClipboardEditor_Buffer[bufLen] = '\n';
+ bufLen++;
+ }
+ size_t bufCopy = len;
+ if (bufLen + bufCopy >= ClipboardEditorBufferSize) bufCopy = ClipboardEditorBufferSize - bufLen - 1;
+ memcpy(ClipboardEditor_Buffer + bufLen, buffer, bufCopy + 1);
+ ClipboardEditor_Buffer[bufLen + bufCopy] = '\0';
+ }
+ CopyToast_Time = GetTime();
+ Redisplay = 1;
+}
+
global_function
void
CopyEditsToClipBoard(GLFWwindow *window)
@@ -12717,6 +12962,7 @@ MainArgs
FileBrowserInit(&loadBrowser, &media);
FileBrowserInit(&saveAGPBrowser, &media);
FileBrowserInit(&saveEditsBrowser, &media);
+ FileBrowserInit(&saveClipboardBrowser, &media);
FileBrowserInit(&loadAGPBrowser, &media);
}
@@ -12929,7 +13175,19 @@ MainArgs
Stuck_Problem_Check_Debug
- /*nk_input_key(NK_Context, NK_KEY_DEL, glfwGetKey(window, GLFW_KEY_DELETE) == GLFW_PRESS);
+ {
+ static u08 clipboard_ctx_set = 0;
+ if (!clipboard_ctx_set)
+ {
+ NK_Context->clip.userdata = nk_handle_ptr(window);
+ NK_Context->clip.paste = nk_clipboard_paste;
+ NK_Context->clip.copy = nk_clipboard_copy;
+ clipboard_ctx_set = 1;
+ }
+ }
+
+ /* State-based keys for Nuklear text fields (Clipboard Editor, etc.): navigation + Ctrl/Cmd+C/V/X. */
+ nk_input_key(NK_Context, NK_KEY_DEL, glfwGetKey(window, GLFW_KEY_DELETE) == GLFW_PRESS);
nk_input_key(NK_Context, NK_KEY_ENTER, glfwGetKey(window, GLFW_KEY_ENTER) == GLFW_PRESS);
nk_input_key(NK_Context, NK_KEY_TAB, glfwGetKey(window, GLFW_KEY_TAB) == GLFW_PRESS);
nk_input_key(NK_Context, NK_KEY_BACKSPACE, glfwGetKey(window, GLFW_KEY_BACKSPACE) == GLFW_PRESS);
@@ -12937,22 +13195,14 @@ MainArgs
nk_input_key(NK_Context, NK_KEY_RIGHT, glfwGetKey(window, GLFW_KEY_RIGHT) == GLFW_PRESS);
nk_input_key(NK_Context, NK_KEY_UP, glfwGetKey(window, GLFW_KEY_UP) == GLFW_PRESS);
nk_input_key(NK_Context, NK_KEY_DOWN, glfwGetKey(window, GLFW_KEY_DOWN) == GLFW_PRESS);
-
- if (glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS || glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS)
- {
- nk_input_key(NK_Context, NK_KEY_COPY, glfwGetKey(window, GLFW_KEY_C) == GLFW_PRESS);
- nk_input_key(NK_Context, NK_KEY_PASTE, glfwGetKey(window, GLFW_KEY_P) == GLFW_PRESS);
- nk_input_key(NK_Context, NK_KEY_CUT, glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS);
- nk_input_key(NK_Context, NK_KEY_CUT, glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS);
- nk_input_key(NK_Context, NK_KEY_SHIFT, 1);
- }
- else
+ nk_input_key(NK_Context, NK_KEY_SHIFT, glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS || glfwGetKey(window, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS);
{
- nk_input_key(NK_Context, NK_KEY_COPY, 0);
- nk_input_key(NK_Context, NK_KEY_PASTE, 0);
- nk_input_key(NK_Context, NK_KEY_CUT, 0);
- nk_input_key(NK_Context, NK_KEY_SHIFT, 0);
- }*/
+ const int mod = (glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS || glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS
+ || glfwGetKey(window, GLFW_KEY_LEFT_SUPER) == GLFW_PRESS || glfwGetKey(window, GLFW_KEY_RIGHT_SUPER) == GLFW_PRESS);
+ nk_input_key(NK_Context, NK_KEY_COPY, mod && glfwGetKey(window, GLFW_KEY_C) == GLFW_PRESS);
+ nk_input_key(NK_Context, NK_KEY_PASTE, mod && glfwGetKey(window, GLFW_KEY_V) == GLFW_PRESS);
+ nk_input_key(NK_Context, NK_KEY_CUT, mod && glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS);
+ }
nk_input_scroll(NK_Context, NK_Scroll);
NK_Scroll.x = 0;
@@ -12982,8 +13232,10 @@ MainArgs
s32 showLoadStateScreen = 0;
s32 showSaveAGPScreen = 0;
s32 showSaveEditsScreen = 0;
+ static s32 showSaveClipboardScreen = 0;
s32 showLoadAGPScreen = 0;
s32 showMetaDataTagEditor = 0;
+ s32 showClipboardEditor = 0;
s32 showUserProfileScreen = 0;
static u32 currGroup1 = 0;
static u32 currGroup2 = 0;
@@ -13024,9 +13276,10 @@ MainArgs
}
showUserProfileScreen = nk_button_label(NK_Context, "User Profile");
showAboutScreen = nk_button_label(NK_Context, "About");
+ nk_layout_row_dynamic(NK_Context, Screen_Scale.y * 30.0f, 3);
+ showClipboardEditor = nk_button_label(NK_Context, "Clipboard Editor");
if (currFileName)
{
- nk_layout_row_dynamic(NK_Context, Screen_Scale.y * 30.0f, 2);
if (nk_button_label(NK_Context, "Clear Cache")) showClearCacheScreen = 1; // used to clear cache for current opened sample
if (nk_button_label(NK_Context, "Debug Report")) Debug_UI_On = !Debug_UI_On;
}
@@ -14221,9 +14474,28 @@ MainArgs
if (FileBrowserRun("Load AGP", &loadAGPBrowser, NK_Context, (u32)showLoadAGPScreen))
Load_AGP(loadAGPBrowser.file);
+ }
+ MetaTagsEditorRun(NK_Context, (u08)showMetaDataTagEditor);
+ s32 saveAsClicked = 0;
+ ClipboardEditorRun(NK_Context, (u08)showClipboardEditor, window, &showSaveClipboardScreen, &saveAsClicked);
- MetaTagsEditorRun(NK_Context, (u08)showMetaDataTagEditor);
+ {
+ struct nk_window *clipEdW = nk_window_find(NK_Context, "Clipboard Editor");
+ if (clipEdW && (clipEdW->flags & NK_WINDOW_HIDDEN))
+ showSaveClipboardScreen = 0;
+ struct nk_window *saveClipW = nk_window_find(NK_Context, "Save Clipboard");
+ if (saveClipW && (saveClipW->flags & NK_WINDOW_HIDDEN) && !saveAsClicked)
+ showSaveClipboardScreen = 0;
+ u08 state;
+ if ((state = FileBrowserRun("Save Clipboard", &saveClipboardBrowser, NK_Context, (u32)showSaveClipboardScreen, 4)))
+ {
+ FenceIn(SaveClipboardToFile(saveClipboardBrowser.file, state & 2));
+ FileBrowserReloadDirectoryContent(&saveClipboardBrowser, saveClipboardBrowser.directory);
+ struct nk_window *saveClipboardWindow = nk_window_find(NK_Context, "Save Clipboard");
+ if (saveClipboardWindow) saveClipboardWindow->flags |= NK_WINDOW_HIDDEN;
+ showSaveClipboardScreen = 0;
+ }
}
AboutWindowRun(NK_Context, (u32)showAboutScreen);
diff --git a/meson.build b/meson.build
index a9fa5b0..a1d942c 100644
--- a/meson.build
+++ b/meson.build
@@ -35,7 +35,7 @@ else # windows
endif
# lib of deflate
-# 通过 static_library() 函数创建了静态库 libdeflate,
+# Created static library libdeflate using the static_library() function.
libdeflate = static_library('deflate', 'subprojects/libdeflate/lib/deflate_compress.c', 'subprojects/libdeflate/lib/deflate_decompress.c', 'subprojects/libdeflate/lib/utils.c',
c_args : flags,
link_with : [
diff --git a/src/utilsPretextView.h b/src/utilsPretextView.h
index 2982c03..1cf6c09 100644
--- a/src/utilsPretextView.h
+++ b/src/utilsPretextView.h
@@ -182,7 +182,7 @@ GLuint CreateShader(
#define NK_INCLUDE_DEFAULT_ALLOCATOR
#define NK_IMPLEMENTATION
#define NK_INCLUDE_STANDARD_VARARGS
-//#define NK_KEYSTATE_BASED_INPUT
+#define NK_KEYSTATE_BASED_INPUT
#ifndef DEBUG
#define NK_ASSERT(x)
#endif