Skip to content

Commit

Permalink
Merge pull request #104 from roberthawdon/v0.8-dev
Browse files Browse the repository at this point in the history
V0.8 dev to master
  • Loading branch information
roberthawdon authored Jun 19, 2019
2 parents 777e5f0 + 3bc4d19 commit 8aefd03
Show file tree
Hide file tree
Showing 14 changed files with 393 additions and 207 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.o
.deps
.dirstamp
.vscode
/Makefile
Makefile.in
aclocal.m4
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DF-SHOW

:Author: Robert Ian Hawdon (git@robertianhawdon.me.uk)
:Source: https://github.com/roberthawdon/dfshow
:Version: alpha
:Version: beta

**DF-SHOW (Directory File Show) is a Unix-like rewrite of some of the applications from Larry Kroeker's DF-EDIT (Directory File Editor) for MS-DOS and PC-DOS systems, based on the Version 2.3d release from 1986.**

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([dfshow], [0.7.0], [https://github.com/roberthawdon/dfshow/issues])
AC_INIT([dfshow], [0.8.0], [https://github.com/roberthawdon/dfshow/issues])
AC_GNU_SOURCE
AM_INIT_AUTOMAKE([subdir-objects])
AC_PROG_CC
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.7.0-alpha'
release = '0.8.0-beta'


# -- General configuration ---------------------------------------------------
Expand Down
9 changes: 6 additions & 3 deletions src/colors.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ void loadTheme(){
} else {
curs_set(FALSE);
topLineMessage("Error: Unable to read file");
curs_set(TRUE);
// curs_set(TRUE);
}
}
themeBuilder();
Expand Down Expand Up @@ -832,8 +832,11 @@ void themeBuilder()
setColors(DEFAULT_BOLD_PAIR);
mvprintw(22, 22, "Select 0 to F for desired %s color", fgbgLabel);

curs_set(TRUE);
move(colorThemePos + 2, 1);
// curs_set(TRUE);
// move(colorThemePos + 2, 1);
attron(A_REVERSE);
mvprintw(colorThemePos + 2, 1, " ");
attroff(A_REVERSE);


}
32 changes: 24 additions & 8 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ wchar_t *settingsMenuLabel;

extern int * pc;

extern char fileMenuText[256];

extern int resized;

void refreshScreen(); // This reference needs to exist to allow getch10th to be common.
Expand Down Expand Up @@ -999,20 +997,32 @@ void printSetting(int line, int col, settingIndex **settings, t1CharValues **val
settingWork = (*settings)[index].intSetting;
}
setColors(HILITE_PAIR);
mvprintw(line, col, "[");
if (settingsPos == index){
attron(A_REVERSE);
}
if (settingWork == 0){
mvprintw(line, col, "[ ]");
mvprintw(line, col + 1, " ");
} else {
mvprintw(line, col, "[*]");
mvprintw(line, col + 1, "*");
}
attroff(A_REVERSE);
mvprintw(line, col + 2, "]");
setColors(COMMAND_PAIR);
mvprintw(line, col + 4, "%ls", (*settings)[index].textLabel);
} else if (type == 1){
setColors(HILITE_PAIR);
mvprintw(line, col, "<");
if (settingsPos == index){
attron(A_REVERSE);
}
if ((*settings)[index].maxValue > 0) {
mvprintw(line, col, "<->");
mvprintw(line, col + 1, "-");
} else {
mvprintw(line, col, "<?>");
mvprintw(line, col + 1, "?");
}
attroff(A_REVERSE);
mvprintw(line, col + 2, ">");
setColors(COMMAND_PAIR);
mvprintw(line, col + 4, "%ls:", (*settings)[index].textLabel);
for(i = 0; i < ((*settings)[index].maxValue); i++){
Expand All @@ -1028,11 +1038,17 @@ void printSetting(int line, int col, settingIndex **settings, t1CharValues **val
}
} else if (type == 2){
setColors(HILITE_PAIR);
mvprintw(line, col, "<");
if (settingsPos == index && settingsBinPos < 0){
attron(A_REVERSE);
}
if ((*settings)[index].maxValue > 0) {
mvprintw(line, col, "< >");
mvprintw(line, col + 1, " ");
} else {
mvprintw(line, col, "<?>");
mvprintw(line, col + 1, "?");
}
attroff(A_REVERSE);
mvprintw(line, col + 2, ">");
setColors(COMMAND_PAIR);
mvprintw(line, col + 4, "%ls:", (*settings)[index].textLabel);
for(i = 0; i < ((*settings)[index].maxValue); i++){
Expand Down
39 changes: 13 additions & 26 deletions src/sf.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#include "sfmenus.h"
#include "sf.h"

char fileMenuText[100];
char filePosText[58];

char regexinput[1024];

Expand All @@ -56,7 +54,7 @@ int wrapmode = LINE_WRAP;

int launchSettingsMenu = 0;

char fileName[512];
char fileName[4096];

int resized = 0;

Expand Down Expand Up @@ -86,10 +84,10 @@ extern int * pc;
extern int settingsPos;
extern int settingsBinPos;

extern char globalConfLocation[128];
extern char homeConfLocation[128];
extern char globalConfLocation[4096];
extern char homeConfLocation[4096];

extern char themeName[128];
extern char themeName[256];

extern wchar_t *fileMenuLabel;

Expand Down Expand Up @@ -136,12 +134,6 @@ void readConfig(const char * confFile)
}
}

void buildMenuText(){
// Writing Menus
// Fun fact, in DF-EDIT 2.3d, the following text input typoed "absolute" as "absolue", this typo also exists in the Windows version from 1997 (2.3d-76), however, the 1986 documentation correctly writes it as "absolute".
strcpy(filePosText, "Position relative (<+num> || <-num>) or absolute (<num>):");
}

void refreshScreen()
{
endwin();
Expand All @@ -153,12 +145,9 @@ void refreshScreen()
refreshMenuLabels();
if (viewmode == 0){
mvprintw(0,0,"Show File - Enter pathname:");
} else if (viewmode == 1){
// printMenu(0, 0, fileMenuText);
} else if (viewmode > 0){
wPrintMenu(0, 0, fileMenuLabel);
loadFile(fileName);
} else if (viewmode == 2){
printMenu(0,0,filePosText);
}
}

Expand Down Expand Up @@ -241,11 +230,11 @@ The THEME argument can be:\n"), stdout);

void fileShowStatus()
{
wchar_t statusText[1024];
wchar_t statusText[5120];
if (wrap){
swprintf(statusText, 1024, L"File = <%s> Top = <%i>", fileName, topline);
swprintf(statusText, 5120, L"File = <%s> Top = <%i>", fileName, topline);
} else {
swprintf(statusText, 1024, L"File = <%s> Top = <%i:%i>", fileName, topline, leftcol);
swprintf(statusText, 5120, L"File = <%s> Top = <%i:%i>", fileName, topline, leftcol);
}
wPrintMenu(LINES - 1, 0, statusText);
}
Expand Down Expand Up @@ -348,7 +337,6 @@ void file_view(char * currentfile)
clear();
setColors(COMMAND_PAIR);

// printMenu(0, 0, fileMenuText);

displaysize = LINES - 2;

Expand Down Expand Up @@ -437,11 +425,11 @@ void settingsMenuView()

while(1)
{
if (settingsBinPos < 0){
curs_set(TRUE);
} else {
curs_set(FALSE);
}
// if (settingsBinPos < 0){
// curs_set(TRUE);
// } else {
// curs_set(FALSE);
// }
for (count = 0; count < items; count++){
printSetting(2 + count, 3, &settingIndex, &charValues, &binValues, count, charValuesCount, binValuesCount, settingIndex[count].type, settingIndex[count].invert);
}
Expand Down Expand Up @@ -582,7 +570,6 @@ int main(int argc, char *argv[])
}

generateDefaultMenus();
buildMenuText();

set_escdelay(10);
//ESCDELAY = 10;
Expand Down
1 change: 0 additions & 1 deletion src/sf.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ enum

void readConfig(const char * confFile);
void saveConfig(const char * confFile, settingIndex **settings, t1CharValues **values, t2BinValues **bins, int items, int charIndex, int binIndex);
void buildMenuText();
int calculateTab(int pos);
void file_view(char * currentfile);
void fileShowStatus();
Expand Down
13 changes: 9 additions & 4 deletions src/sfmenus.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ extern menuDef *settingsMenu;
extern int settingsMenuSize;
extern wchar_t *settingsMenuLabel;

extern char fileMenuText[74];
extern char filePosText[58];
extern char regexinput[1024];
extern FILE *file;
extern int topline;
extern int leftcol;
extern char fileName[512];
extern char fileName[4096];
extern int displaysize;
extern int totallines;
extern int longestlongline;
Expand Down Expand Up @@ -166,11 +164,18 @@ int show_file_find_case_input()
void show_file_position_input(int currentpos)
{
char newpos[11];
char *filePosText;
int filePosTextLen;
int status;
// Fun fact, in DF-EDIT 2.3d, the following text input typoed "absolute" as "absolue", this typo also exists in the Windows version from 1997 (2.3d-76), however, the 1986 documentation correctly writes it as "absolute".
filePosTextLen = snprintf(NULL, 0, "Position relative (<+num> || <-num>) or absolute (<num>):");
filePosText = malloc(sizeof(char) * (filePosTextLen + 1));
sprintf(filePosText, "Position relative (<+num> || <-num>) or absolute (<num>):");
viewmode = 2;
move(0,0);
clrtoeol();
printMenu(0,0,filePosText);
free(filePosText);
curs_set(TRUE);
move(0,52);
status = readline(newpos, 11, ""); // DF-EDIT defaulted to 0, but it also defaulted to overtype mode, so for ease of use, we'll leave the default blank.
Expand Down Expand Up @@ -314,7 +319,7 @@ void show_file_file_input()
mvprintw(0,0,"Show File - Enter pathname:");
curs_set(TRUE);
move(0,28);
readline(fileName, 512, "");
readline(fileName, 4096, "");
curs_set(FALSE);
if (check_first_char(fileName, "~")){
rewrite = str_replace(fileName, "~", getenv("HOME"));
Expand Down
30 changes: 14 additions & 16 deletions src/show.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
#include "common.h"
#include "show.h"

char currentpwd[1024];
char currentpwd[4096];

int viewMode = 0;
int resized = 0;

char sortmode[5] = "name";
char sortmode[9] = "name";
char timestyle[9] = "locale";
int reverse = 0;
int human = 0;
Expand Down Expand Up @@ -81,13 +81,12 @@ extern history *hs;
extern int topfileref;
extern int selected;
extern int totalfilecount;
extern char sortmode[5];
extern int showhidden;

extern char globalConfLocation[128];
extern char homeConfLocation[128];
extern char globalConfLocation[4096];
extern char homeConfLocation[4096];

extern char themeName[128];
extern char themeName[256];

struct sigaction sa;

Expand Down Expand Up @@ -416,11 +415,11 @@ void settingsMenuView(){

while(1)
{
if (settingsBinPos < 0){
curs_set(TRUE);
} else {
curs_set(FALSE);
}
// if (settingsBinPos < 0){
// curs_set(TRUE);
// } else {
// curs_set(FALSE);
// }
for (count = 0; count < items; count++){
printSetting(2 + count, 3, &settingIndex, &charValues, &binValues, count, charValuesCount, binValuesCount, settingIndex[count].type, settingIndex[count].invert);
}
Expand All @@ -441,7 +440,6 @@ void settingsMenuView(){
createParentDirs(homeConfLocation);
}
saveConfig(homeConfLocation, &settingIndex, &charValues, &binValues, items, charValuesCount, binValuesCount);
// Future task: ensure saving actually worked
curs_set(FALSE);
topLineMessage("Settings saved.");
curs_set(TRUE);
Expand Down Expand Up @@ -512,7 +510,7 @@ int directory_view(char * currentpwd)
wPrintMenu(0, 0, fileMenuLabel);

set_history(currentpwd, "", "", 0, 0);
free(ob);
freeResults(ob, totalfilecount);
ob = get_dir(currentpwd);
reorder_ob(ob, sortmode);
display_dir(currentpwd, ob, topfileref, 0);
Expand All @@ -526,7 +524,7 @@ int directory_view(char * currentpwd)

directory_view_menu_inputs();

free(ob); //freeing memory
freeResults(ob, totalfilecount); //freeing memory
return 0;
}

Expand Down Expand Up @@ -787,7 +785,7 @@ Valid arguments are:\n\
}
break;
case 'f':
strcpy(sortmode, "none"); // This can be set to anything non valid
strcpy(sortmode, "unsorted"); // This needs to be set to "unsorted" to allow the settings menu to render correctly.
showhidden = 1;
break;
case 'S':
Expand Down Expand Up @@ -830,7 +828,7 @@ Valid arguments are:\n\
reverse = 1;
break;
case 'U':
strcpy(sortmode, "none"); // Again, invalid
strcpy(sortmode, "unsorted");
break;
case GETOPT_NODANGER_CHAR:
danger = 0;
Expand Down
Loading

0 comments on commit 8aefd03

Please sign in to comment.