This commit is contained in:
2026-07-26 20:34:15 +02:00
parent c2feeddbbb
commit d0d6623346
4 changed files with 96 additions and 3 deletions
+20
View File
@@ -0,0 +1,20 @@
# Design of DocMan
There are two kinds of tabs: library tab and viewer tab.
The book library is a split view: on the left, the list of books in
the library; on the right, the metadata of the currently selected
book, which has editable fields.
How does the library work? It's just a folder, no database, no
nothing. The way the folder is organized is completely up to the
user. It could just be a mashup of PDFs and EPUBs, completely without
any subfolders. The software organizes those files into a neat view.
Second, the document viewer. It's something vastly more optimized than
the GNOME bloatware, something that uses perhaps Poppler, like
qpdfview which is absurdly fast. The document viewer can annotate,
make bookmarks, etc. None or several tabs of the viewer can be opened
at once.
DocMan should be like the DeaDBeeF or Foobar2000 but for books.
View File
+1 -1
View File
@@ -1,3 +1,3 @@
#+TITLE: DocMan
# DocMan
A document and book management system, similar to Calibre.
+75 -2
View File
@@ -1,14 +1,87 @@
#include <iup.h>
#include <stddef.h>
#define DOCMAN_DOC_FILTER "PDF files|*.pdf|DjVu files|*.djvu|EPUB files|*.epub|MOBI files|*.mobi|AZW files|*.azw;*.azw3;*.kfx|"
Ihandle *tabs;
int
callback_open_lib (Ihandle *item)
{
Ihandle *file_dlg = IupFileDlg ();
IupSetAttribute (file_dlg, "DIALOGTYPE", "DIR");
IupSetAttributeHandle (file_dlg, "PARENTDIALOG", IupGetDialog (item));
IupPopup (file_dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
Ihandle *lst = IupList (NULL);
IupSetAttribute (lst, "EXPAND", "YES");
IupAppend (tabs, lst);
IupMap (lst);
IupRefresh (tabs);
IupDestroy (file_dlg);
return IUP_DEFAULT;
}
int
callback_open_file (Ihandle *item)
{
Ihandle *file_dlg = IupFileDlg ();
IupSetAttribute (file_dlg, "DIALOGTYPE", "OPEN");
IupSetAttribute (file_dlg, "EXTFILTER", DOCMAN_DOC_FILTER);
IupSetAttribute (file_dlg, "MULTIPLEFILES", "YES");
IupSetAttributeHandle (file_dlg, "PARENTDIALOG", IupGetDialog (item));
/* TODO: SHOWPREVIEW */
IupPopup (file_dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
Ihandle *ml = IupMultiLine (NULL);
IupSetAttribute (ml, "EXPAND", "YES");
IupAppend (tabs, ml);
IupMap (ml);
IupRefresh (tabs);
IupDestroy (file_dlg);
return IUP_DEFAULT;
}
int
callback_exit (Ihandle *unused)
{
(void) unused;
return IUP_CLOSE;
}
int
main (int argc, char **argv)
{
IupOpen (&argc, &argv);
Ihandle *dlg = IupDialog (NULL);
IupSetAttribute (dlg, "TITLE", "DocMan");
tabs = IupTabs (NULL);
IupSetAttribute (tabs, "SHOWCLOSE", "YES");
Ihandle *dlg = IupDialog (tabs);
IupSetAttribute (dlg, "TITLE", "DocMan");
IupSetAttribute (dlg, "SIZE", "HALFxHALF");
Ihandle *item_open_lib = IupItem ("Open library", NULL);
IupSetCallback (item_open_lib, "ACTION", (Icallback) callback_open_lib);
Ihandle *item_open_file = IupItem ("Open file", NULL);
IupSetCallback (item_open_file, "ACTION", (Icallback) callback_open_file);
Ihandle *item_exit = IupItem ("Exit", NULL);
IupSetCallback (item_exit, "ACTION", (Icallback) callback_exit);
Ihandle *file_menu = IupMenu (item_open_lib, item_open_file, IupSeparator (), item_exit, NULL);
Ihandle *submenu = IupSubmenu ("File", file_menu);
IupSetAttributeHandle (dlg, "MENU", IupMenu (submenu, NULL));
IupShowXY (dlg, IUP_CENTER, IUP_CENTER);
IupMainLoop ();
IupClose ();