Image 01
profile-image

Eggnog

J Webster
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

Hmmm...

I get something like this:

eggnog@Axrena Bahira]$ kcmshell kcmbaghira
QMutex::unlock: unlock from different thread than locker
was locked by 0, unlock attempt from 1090462624

Strange. Never seen this before.

You're much faster than Mosfet ever was with the developments. But, being fair to him too, he also had a full-time job as well. Last time I talked to him, he said he just didn't have the time to devote to KDE anymore.

No eating at university terminals? Since when? And since when do they use LINUX ;- )

Sliders: I guess all of my ranting about sliders has to do with wanting to achieve something like the sliders in the "Klacier" pixmap theme. I think your platform would be most suited for something like this.

Cheers,
Nawg - Dec 13 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

Hmmm...

I get something like this:

#include
#include
#include
#include
#include


#define MAX_STRING (80) /* Longest allowed response */
#define MAX_ENTRY (1024) /* Longest allowed database entry */

#define MESSAGE_LINE 6 /* Misc. messages go here */
#define ERROR_LINE 22 /* The line to use for errors */
#define Q_LINE 20 /* Line for Questions */
#define PROMPT_LINE 18 /* Line for prompting on */


static char current_cd[MAX_STRING] = "\0";
static char current_cat[MAX_STRING];


const char *title_file = "title.cdb";
const char *tracks_file = "tracks.cdb";
const char *temp_file = "cdb.tmp";


/* Prototypes for local functions */
void clear_all_screen(void);
void get_return(void);
int get_confirm(void);
int getchoice(char *greet, char *choices[]);
void draw_menu(char *options[], int highlight, int start_row, int start_col);
void insert_title(char *cdtitle);
void get_string(char *string);
void add_record(void);
void count_cds(void);
void find_cd(void);
void list_tracks(void);
void remove_tracks(void);
void remove_cd(void);
void update_cd(void);

char *main_menu[] =
{
"aadd new CD",
"ffind CD",
"ccount CDs and tracks in the catalog",
"qquit",
0,
};

/*
The extended menu is displayed when a CD is currently selected
*/
char *extended_menu[] =
{
"aadd new CD",
"ffind CD",
"ccount CDs and tracks in the catalog",
"llist tracks on current CD",
"rremove current CD",
"uupdate track information",
"qquit",
0,
};

Weird - Dec 13 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

Hmmm...

I get something like this:

#include
#include
#include
#include
#include


#define MAX_STRING (80) /* Longest allowed response */
#define MAX_ENTRY (1024) /* Longest allowed database entry */

#define MESSAGE_LINE 6 /* Misc. messages go here */
#define ERROR_LINE 22 /* The line to use for errors */
#define Q_LINE 20 /* Line for Questions */
#define PROMPT_LINE 18 /* Line for prompting on */


static char current_cd[MAX_STRING] = "\0";
static char current_cat[MAX_STRING];


const char *title_file = "title.cdb";
const char *tracks_file = "tracks.cdb";
const char *temp_file = "cdb.tmp";


/* Prototypes for local functions */
void clear_all_screen(void);
void get_return(void);
int get_confirm(void);
int getchoice(char *greet, char *choices[]);
void draw_menu(char *options[], int highlight, int start_row, int start_col);
void insert_title(char *cdtitle);
void get_string(char *string);
void add_record(void);
void count_cds(void);
void find_cd(void);
void list_tracks(void);
void remove_tracks(void);
void remove_cd(void);
void update_cd(void);

char *main_menu[] =
{
"aadd new CD",
"ffind CD",
"ccount CDs and tracks in the catalog",
"qquit",
0,
};

/*
The extended menu is displayed when a CD is currently selected
*/
char *extended_menu[] =
{
"aadd new CD",
"ffind CD",
"ccount CDs and tracks in the catalog",
"llist tracks on current CD",
"rremove current CD",
"uupdate track information",
"qquit",
0,
};

int main()
{
int choice;

initscr();

do {

choice = getchoice("Options:", current_cd[0] ? extended_menu : main_menu);

switch (choice) {
case 'q':
break;

case 'a':
add_record();
break;

case 'c':
count_cds();
break;

case 'f':
find_cd();
break;

case 'l':
list_tracks();
break;

case 'r':
remove_cd();
break;

case 'u':
update_cd();
break;
}
} while (choice != 'q');

endwin();
exit(EXIT_SUCCESS);

} /* main */

/*
getchoice - ask the user to choose
passed: greet, an introduction
choices, an array of strings, NULL at end
*/
int getchoice(char *greet, char *choices[])
{
static int selected_row = 0;
int max_row = 0;
int start_screenrow = MESSAGE_LINE, start_screencol = 10;
char **option;
int selected;
int key = 0;

option = choices;
while (*option) {
max_row++;
option++;
}

/* protect against menu getting shorted when CD deleted */
if (selected_row >= max_row)
selected_row = 0;

clear_all_screen();
mvprintw(start_screenrow - 2, start_screencol, greet);

keypad(stdscr, TRUE);
cbreak();
noecho();

key = 0;
while (key != 'q' && key != KEY_ENTER && key != '\n') {
if (key == KEY_UP) {
if (selected_row == 0)
selected_row = max_row - 1;
else
selected_row--;
}
if (key == KEY_DOWN) {
if (selected_row == (max_row - 1))
selected_row = 0;
else
selected_row++;
}
selected = *choices[selected_row];
draw_menu(choices, selected_row, start_screenrow, start_screencol);
key = getch();
}

keypad(stdscr, FALSE);
nocbreak();
echo();

if (key == 'q')
selected = 'q';

return (selected);

}

void draw_menu(char *options[], int current_highlight, int start_row, int start_col)
{
int current_row = 0;
char **option_ptr;
char *txt_ptr;

option_ptr = options;
while (*option_ptr) {
if (current_row == current_highlight) {
mvaddch(start_row + current_row, start_col - 3, ACS_BULLET);
mvaddch(start_row + current_row, start_col + 40, ACS_BULLET);
} else {
mvaddch(start_row + current_row, start_col - 3, ' ');
mvaddch(start_row + current_row, start_col + 40, ' ');
}

txt_ptr = options[current_row];
txt_ptr++;
mvprintw(start_row + current_row, start_col, "%s", txt_ptr);
current_row++;
option_ptr++;
}

mvprintw(start_row + current_row + 3, start_col, "Move highlight then press Return ");

refresh();
}

void clear_all_screen()
{
clear();
mvprintw(2, Q_LINE, "%s", "CD Database Application");
if (current_cd[0]) {
mvprintw(ERROR_LINE, 0, "Current CD: %s: %s\n", current_cat, current_cd);
}
refresh();
}


/*
get_return

Prompt for and read a carriage return.
Ignore other characters.
*/
void get_return()
{
int ch;
mvprintw(23, 0, "%s", " Press return ");
refresh();
while ((ch = getchar()) != '\n' && ch != EOF);
}


int get_confirm()
{
int confirmed = 0;
char first_char = 'N';

mvprintw(Q_LINE, 5, "Are you sure? ");
clrtoeol();
refresh();

cbreak();
first_char = getch();
if (first_char == 'Y' || first_char == 'y') {
confirmed = 1;
}
nocbreak();

if (!confirmed) {
mvprintw(Q_LINE, 1, " Cancelled");
clrtoeol();
refresh();
sleep(1);
}
return confirmed;
}


/*
Database File Manipulation Functions
*/

/*
insert_title

Add a title to the CD database
Simply add the title string to the end of the titles file

*/
void insert_title(char *cdtitle)
{
FILE *fp = fopen(title_file, "a");
if (!fp) {
mvprintw(ERROR_LINE, 0, "cannot open CD titles database");
} else {
fprintf(fp, "%s\n", cdtitle);
fclose(fp);
}
}


/*
get_string

At the current screen position prompt for and read a string
Delete any trailing newline.
*/
void get_string(char *string)
{
int len;

wgetnstr(stdscr, string, MAX_STRING);
len = strlen(string);
if (len > 0 && string[len - 1] == '\n')
string[len - 1] = '\0';
}



void add_record()
{
char catalog_number[MAX_STRING];
char cd_title[MAX_STRING];
char cd_type[MAX_STRING];
char cd_artist[MAX_STRING];
char cd_entry[MAX_STRING];

int screenrow = MESSAGE_LINE;
int screencol = 10;

clear_all_screen();
mvprintw(screenrow, screencol, "Enter new CD details");
screenrow += 2;

mvprintw(screenrow, screencol, "Catalog Number: ");
get_string(catalog_number);
screenrow++;

mvprintw(screenrow, screencol, " CD Title: ");
get_string(cd_title);
screenrow++;

mvprintw(screenrow, screencol, " CD Type: ");
get_string(cd_type);
screenrow++;

mvprintw(screenrow, screencol, " Artist: ");
get_string(cd_artist);
screenrow++;

mvprintw(15, 5, "About to add this new entry:");
sprintf(cd_entry, "%s,%s,%s,%s", catalog_number, cd_title, cd_type, cd_artist);
mvprintw(17, 5, "%s", cd_entry);
refresh();

move(PROMPT_LINE, 0);
if (get_confirm()) {
insert_title(cd_entry);
strcpy(current_cd, cd_title);
strcpy(current_cat, catalog_number);
}
}

/*
count_cds - scan the database and count titles and tracks
*/
void count_cds()
{
FILE *titles_fp, *tracks_fp;
char entry[MAX_ENTRY];
int titles = 0;
int tracks = 0;

titles_fp = fopen(title_file, "r");
if (titles_fp) {
while (fgets(entry, MAX_ENTRY, titles_fp))
titles++;
fclose(titles_fp);
}
tracks_fp = fopen(tracks_file, "r");
if (tracks_fp) {
while (fgets(entry, MAX_ENTRY, tracks_fp))
tracks++;
fclose(tracks_fp);
}
mvprintw(ERROR_LINE, 0, "Database contains %d titles, with a total of %d tracks.", titles, tracks);
get_return();
}

/*
find_cd - locate a CD in the database

prompt for a substring to match in the database
set current_cd to the CD title

*/
void find_cd()
{
char match[MAX_STRING], entry[MAX_ENTRY];
FILE *titles_fp;
int count = 0;
char *found, *title, *catalog;

mvprintw(Q_LINE, 0, "Enter a string to search for in CD titles: ");
get_string(match);

titles_fp = fopen(title_file, "r");
if (titles_fp) {
while (fgets(entry, MAX_ENTRY, titles_fp)) {

/* Skip past catalog number */
catalog = entry;
if (found = strstr(catalog, ",")) {
*found = 0;
title = found + 1;

/* Zap the next comma in the entry to reduce it to title only */
if (found = strstr(title, ",")) {
*found = '\0';

/* Now see if the match substring is present */
if (found = strstr(title, match)) {
count++;
strcpy(current_cd, title);
strcpy(current_cat, catalog);
}
}
}
}
fclose(titles_fp);
}
if (count != 1) {
if (count == 0)
mvprintw(ERROR_LINE, 0, "Sorry, no matching CD found. ");
if (count > 1)
mvprintw(ERROR_LINE, 0, "Sorry, match is ambiguous: %d CDs found. ", count);
current_cd[0] = '\0';
get_return();
}
}


/*
remove_tracks - delete tracks from the current CD
*/
void remove_tracks()
{
FILE *tracks_fp, *temp_fp;
char entry[MAX_ENTRY];
int cat_length;

if (current_cd[0] == '\0')
return;

cat_length = strlen(current_cat);

tracks_fp = fopen(tracks_file, "r");
temp_fp = fopen(temp_file, "w");

while (fgets(entry, MAX_ENTRY, tracks_fp)) {
/* Compare catalog number and copy entry if no match */
if (strncmp(current_cat, entry, cat_length) != 0)
fputs(entry, temp_fp);
}
fclose(tracks_fp);
fclose(temp_fp);

unlink(tracks_file);
rename(temp_file, tracks_file);
}

void remove_cd()
{
FILE *titles_fp, *temp_fp;
char entry[MAX_ENTRY];
int cat_length;

if (current_cd[0] == '\0')
return;

clear_all_screen();
mvprintw(PROMPT_LINE, 0, "About to remove CD %s: %s. ", current_cat, current_cd);
if (!get_confirm())
return;

cat_length = strlen(current_cat);

/* Copy the titles file to a temporary, ignoring this CD */
titles_fp = fopen(title_file, "r");
temp_fp = fopen(temp_file, "w");

while (fgets(entry, MAX_ENTRY, titles_fp)) {
/* Compare catalog number and copy entry if no match */
if (strncmp(current_cat, entry, cat_length) != 0)
fputs(entry, temp_fp);
}
fclose(titles_fp);
fclose(temp_fp);

remove_tracks();

/* Reset current CD to 'None' */
current_cd[0] = '\0';
}



#define BOXED_LINES 11
#define BOXED_ROWS 60
#define BOX_LINE_POS 8
#define BOX_ROW_POS 2

void list_tracks()
{
FILE *tracks_fp;
char entry[MAX_ENTRY];
int cat_length;
int lines_op = 0;
WINDOW *track_pad_ptr;
int tracks = 0;
int key;
int first_line = 0;

if (current_cd[0] == '\0') {
mvprintw(ERROR_LINE, 0, "You must select a CD first. ", stdout);
get_return();
return;
}
clear_all_screen();
cat_length = strlen(current_cat);

/* First count the number of tracks for the current CD */
tracks_fp = fopen(tracks_file, "r");
if (!tracks_fp)
return;
while (fgets(entry, MAX_ENTRY, tracks_fp)) {
if (strncmp(current_cat, entry, cat_length) == 0)
tracks++;
}
fclose(tracks_fp);


/* Make a new pad, ensure that even if there is only a single
track the PAD is large enough so the later prefresh() is always
valid.
*/
track_pad_ptr = newpad(tracks + 1 + BOXED_LINES, BOXED_ROWS + 1);
if (!track_pad_ptr)
return;

tracks_fp = fopen(tracks_file, "r");
if (!tracks_fp)
return;

mvprintw(4, 0, "CD Track Listing\n");

/* write the track information into the pad */
while (fgets(entry, MAX_ENTRY, tracks_fp)) {
/* Compare catalog number and output rest of entry */
if (strncmp(current_cat, entry, cat_length) == 0) {
mvwprintw(track_pad_ptr, lines_op++, 0, "%s", entry + cat_length + 1);
}
}
fclose(tracks_fp);

if (lines_op > BOXED_LINES) {
mvprintw(MESSAGE_LINE, 0, "Cursor keys to scroll, RETURN or q to exit");
} else {
mvprintw(MESSAGE_LINE, 0, "RETURN or q to exit");
}
wrefresh(stdscr);
keypad(stdscr, TRUE);
cbreak();
noecho();

key = 0;
while (key != 'q' && key != KEY_ENTER && key != '\n') {
if (key == KEY_UP) {
if (first_line > 0)
first_line--;
}
if (key == KEY_DOWN) {
if (first_line + BOXED_LINES + 1 < tracks)
first_line++;
}
/* now draw the appropriate part of the pad on the screen */
prefresh(track_pad_ptr, first_line, 0,
BOX_LINE_POS, BOX_ROW_POS,
BOX_LINE_POS + BOXED_LINES, BOX_ROW_POS + BOXED_ROWS);
/* wrefresh(stdscr); */
key = getch();
}

delwin(track_pad_ptr);
keypad(stdscr, FALSE);
nocbreak();
echo();
}


void update_cd()
{
FILE *tracks_fp;
char track_name[MAX_STRING];
int len;
int track = 1;
int screen_line = 1;
WINDOW *box_window_ptr;
WINDOW *sub_window_ptr;

clear_all_screen();
mvprintw(PROMPT_LINE, 0, "Re-entering tracks for CD. ");
if (!get_confirm())
return;
move(PROMPT_LINE, 0);
clrtoeol();

remove_tracks();

mvprintw(MESSAGE_LINE, 0, "Enter a blank line to finish");

tracks_fp = fopen(tracks_file, "a");

box_window_ptr = subwin(stdscr, BOXED_LINES + 2, BOXED_ROWS + 2,
BOX_LINE_POS - 1, BOX_ROW_POS - 1);
if (!box_window_ptr)
return;
box(box_window_ptr, ACS_VLINE, ACS_HLINE);

sub_window_ptr = subwin(stdscr, BOXED_LINES, BOXED_ROWS,
BOX_LINE_POS, BOX_ROW_POS);
if (!sub_window_ptr)
return;
scrollok(sub_window_ptr, TRUE);
werase(sub_window_ptr);
touchwin(stdscr);

do {

mvwprintw(sub_window_ptr, screen_line++, BOX_ROW_POS + 2, "Track %d: ", track);
clrtoeol();
refresh();
wgetnstr(sub_window_ptr, track_name, MAX_STRING);
len = strlen(track_name);
if (len > 0 && track_name[len - 1] == '\n')
track_name[len - 1] = '\0';

if (*track_name)
fprintf(tracks_fp, "%s,%d,%s\n", current_cat, track, track_name);
track++;
if (screen_line > BOXED_LINES - 1) {
/* time to start scrolling */
scroll(sub_window_ptr);
screen_line--;
}
} while (*track_name);
delwin(sub_window_ptr);

fclose(tracks_fp);
}

Weird huh

Cheers Nawg - Dec 13 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

Oops! Wrong paste.

kcmshell kcmbaghira
QMutex::unlock: unlock from different thread than locker
was locked by 0, unlock attempt from 1090462624

This is what I get, but no config applet. No eating at university terminals, but they don't use linux do they?

I guess all of my ranting about the liquid style sliders is about me wanting to achieve something like the "Klacier" style, but then with the wonderful liquid effects. Not some pixmap theme. And I think your platform would be the best to achieve it with.

Icesliders: The sliders absolutely do not inherit their glossy look from the same object as the buttons. Nope ; -) They are less "icey" in my opinion. Now lemme go and install this new version. You must have lot's of freetime on your hands. Or , you don't get much homework done ; -) Before I can install / hack a version, there is a new one. Mosfet was not even so fast ;-)

Cheers,
Nawg - Dec 13 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

Hmmm...

I get something like this:

#include
#include
#include
#include
#include


#define MAX_STRING (80) /* Longest allowed response */
#define MAX_ENTRY (1024) /* Longest allowed database entry */

#define MESSAGE_LINE 6 /* Misc. messages go here */
#define ERROR_LINE 22 /* The line to use for errors */
#define Q_LINE 20 /* Line for Questions */
#define PROMPT_LINE 18 /* Line for prompting on */

/*
The variable current_cd is used to store the CD title we are
working with. It is initialized so that the first character is NUL
to indicate 'no CD selected'. The \0 is strictly unnecessary, but
serves to emphasize the point.

The variable current_cat will be used to record the catalog number
of the current CD.
*/

static char current_cd[MAX_STRING] = "\0";
static char current_cat[MAX_STRING];

/*
File names.

These files are fixed in this version to keep things simple.
The temporary file name is also fixed, this would cause a
problem if this program is run by two users in the same directory.

A better way to obtain data base file names would be either by
program arguments, or from environment variables.

We need a better way to generate a unique a temporary file name.

Many of these issues will be addresed in later versions.
*/

const char *title_file = "title.cdb";
const char *tracks_file = "tracks.cdb";
const char *temp_file = "cdb.tmp";


/* Prototypes for local functions */
void clear_all_screen(void);
void get_return(void);
int get_confirm(void);
int getchoice(char *greet, char *choices[]);
void draw_menu(char *options[], int highlight, int start_row, int start_col);
void insert_title(char *cdtitle);
void get_string(char *string);
void add_record(void);
void count_cds(void);
void find_cd(void);
void list_tracks(void);
void remove_tracks(void);
void remove_cd(void);
void update_cd(void);


/*
Menu structures.
The first character is the character to return when the
chice is selected, the remaining text is to be displayed.
*/
char *main_menu[] =
{
"aadd new CD",
"ffind CD",
"ccount CDs and tracks in the catalog",
"qquit",
0,
};

/*
The extended menu is displayed when a CD is currently selected
*/
char *extended_menu[] =
{
"aadd new CD",
"ffind CD",
"ccount CDs and tracks in the catalog",
"llist tracks on current CD",
"rremove current CD",
"uupdate track information",
"qquit",
0,
};

int main()
{
int choice;

initscr();

do {

choice = getchoice("Options:", current_cd[0] ? extended_menu : main_menu);

switch (choice) {
case 'q':
break;

case 'a':
add_record();
break;

case 'c':
count_cds();
break;

case 'f':
find_cd();
break;

case 'l':
list_tracks();
break;

case 'r':
remove_cd();
break;

case 'u':
update_cd();
break;
}
} while (choice != 'q');

endwin();
exit(EXIT_SUCCESS);

} /* main */

/*
getchoice - ask the user to choose
passed: greet, an introduction
choices, an array of strings, NULL at end
*/
int getchoice(char *greet, char *choices[])
{
static int selected_row = 0;
int max_row = 0;
int start_screenrow = MESSAGE_LINE, start_screencol = 10;
char **option;
int selected;
int key = 0;

option = choices;
while (*option) {
max_row++;
option++;
}

/* protect against menu getting shorted when CD deleted */
if (selected_row >= max_row)
selected_row = 0;

clear_all_screen();
mvprintw(start_screenrow - 2, start_screencol, greet);

keypad(stdscr, TRUE);
cbreak();
noecho();

key = 0;
while (key != 'q' && key != KEY_ENTER && key != '\n') {
if (key == KEY_UP) {
if (selected_row == 0)
selected_row = max_row - 1;
else
selected_row--;
}
if (key == KEY_DOWN) {
if (selected_row == (max_row - 1))
selected_row = 0;
else
selected_row++;
}
selected = *choices[selected_row];
draw_menu(choices, selected_row, start_screenrow, start_screencol);
key = getch();
}

keypad(stdscr, FALSE);
nocbreak();
echo();

if (key == 'q')
selected = 'q';

return (selected);

}

void draw_menu(char *options[], int current_highlight, int start_row, int start_col)
{
int current_row = 0;
char **option_ptr;
char *txt_ptr;

option_ptr = options;
while (*option_ptr) {
if (current_row == current_highlight) {
mvaddch(start_row + current_row, start_col - 3, ACS_BULLET);
mvaddch(start_row + current_row, start_col + 40, ACS_BULLET);
} else {
mvaddch(start_row + current_row, start_col - 3, ' ');
mvaddch(start_row + current_row, start_col + 40, ' ');
}

txt_ptr = options[current_row];
txt_ptr++;
mvprintw(start_row + current_row, start_col, "%s", txt_ptr);
current_row++;
option_ptr++;
}

mvprintw(start_row + current_row + 3, start_col, "Move highlight then press Return ");

refresh();
}

/*
clear_all_screen

Clear the screen and re-write the title.
If a CD is selected then display the information.
*/
void clear_all_screen()
{
clear();
mvprintw(2, Q_LINE, "%s", "CD Database Application");
if (current_cd[0]) {
mvprintw(ERROR_LINE, 0, "Current CD: %s: %s\n", current_cat, current_cd);
}
refresh();
}


/*
get_return

Prompt for and read a carriage return.
Ignore other characters.
*/
void get_return()
{
int ch;
mvprintw(23, 0, "%s", " Press return ");
refresh();
while ((ch = getchar()) != '\n' && ch != EOF);
}

/*
get_confirm

Prompt for and read confirmation.
Read a string and check first character for Y or y.
On error or other character return no confirmation.
*/
int get_confirm()
{
int confirmed = 0;
char first_char = 'N';

mvprintw(Q_LINE, 5, "Are you sure? ");
clrtoeol();
refresh();

cbreak();
first_char = getch();
if (first_char == 'Y' || first_char == 'y') {
confirmed = 1;
}
nocbreak();

if (!confirmed) {
mvprintw(Q_LINE, 1, " Cancelled");
clrtoeol();
refresh();
sleep(1);
}
return confirmed;
}


/*
Database File Manipulation Functions
*/

/*
insert_title

Add a title to the CD database
Simply add the title string to the end of the titles file

*/
void insert_title(char *cdtitle)
{
FILE *fp = fopen(title_file, "a");
if (!fp) {
mvprintw(ERROR_LINE, 0, "cannot open CD titles database");
} else {
fprintf(fp, "%s\n", cdtitle);
fclose(fp);
}
}


/*
get_string

At the current screen position prompt for and read a string
Delete any trailing newline.
*/
void get_string(char *string)
{
int len;

wgetnstr(stdscr, string, MAX_STRING);
len = strlen(string);
if (len > 0 && string[len - 1] == '\n')
string[len - 1] = '\0';
}

/*
add_record

Add a new CD to the collection
*/

void add_record()
{
char catalog_number[MAX_STRING];
char cd_title[MAX_STRING];
char cd_type[MAX_STRING];
char cd_artist[MAX_STRING];
char cd_entry[MAX_STRING];

int screenrow = MESSAGE_LINE;
int screencol = 10;

clear_all_screen();
mvprintw(screenrow, screencol, "Enter new CD details");
screenrow += 2;

mvprintw(screenrow, screencol, "Catalog Number: ");
get_string(catalog_number);
screenrow++;

mvprintw(screenrow, screencol, " CD Title: ");
get_string(cd_title);
screenrow++;

mvprintw(screenrow, screencol, " CD Type: ");
get_string(cd_type);
screenrow++;

mvprintw(screenrow, screencol, " Artist: ");
get_string(cd_artist);
screenrow++;

mvprintw(15, 5, "About to add this new entry:");
sprintf(cd_entry, "%s,%s,%s,%s", catalog_number, cd_title, cd_type, cd_artist);
mvprintw(17, 5, "%s", cd_entry);
refresh();

move(PROMPT_LINE, 0);
if (get_confirm()) {
insert_title(cd_entry);
strcpy(current_cd, cd_title);
strcpy(current_cat, catalog_number);
}
}

/*
count_cds - scan the database and count titles and tracks
*/
void count_cds()
{
FILE *titles_fp, *tracks_fp;
char entry[MAX_ENTRY];
int titles = 0;
int tracks = 0;

titles_fp = fopen(title_file, "r");
if (titles_fp) {
while (fgets(entry, MAX_ENTRY, titles_fp))
titles++;
fclose(titles_fp);
}
tracks_fp = fopen(tracks_file, "r");
if (tracks_fp) {
while (fgets(entry, MAX_ENTRY, tracks_fp))
tracks++;
fclose(tracks_fp);
}
mvprintw(ERROR_LINE, 0, "Database contains %d titles, with a total of %d tracks.", titles, tracks);
get_return();
}

/*
find_cd - locate a CD in the database

prompt for a substring to match in the database
set current_cd to the CD title

*/
void find_cd()
{
char match[MAX_STRING], entry[MAX_ENTRY];
FILE *titles_fp;
int count = 0;
char *found, *title, *catalog;

mvprintw(Q_LINE, 0, "Enter a string to search for in CD titles: ");
get_string(match);

titles_fp = fopen(title_file, "r");
if (titles_fp) {
while (fgets(entry, MAX_ENTRY, titles_fp)) {

/* Skip past catalog number */
catalog = entry;
if (found = strstr(catalog, ",")) {
*found = 0;
title = found + 1;

/* Zap the next comma in the entry to reduce it to title only */
if (found = strstr(title, ",")) {
*found = '\0';

/* Now see if the match substring is present */
if (found = strstr(title, match)) {
count++;
strcpy(current_cd, title);
strcpy(current_cat, catalog);
}
}
}
}
fclose(titles_fp);
}
if (count != 1) {
if (count == 0)
mvprintw(ERROR_LINE, 0, "Sorry, no matching CD found. ");
if (count > 1)
mvprintw(ERROR_LINE, 0, "Sorry, match is ambiguous: %d CDs found. ", count);
current_cd[0] = '\0';
get_return();
}
}


/*
remove_tracks - delete tracks from the current CD
*/
void remove_tracks()
{
FILE *tracks_fp, *temp_fp;
char entry[MAX_ENTRY];
int cat_length;

if (current_cd[0] == '\0')
return;

cat_length = strlen(current_cat);

tracks_fp = fopen(tracks_file, "r");
temp_fp = fopen(temp_file, "w");

while (fgets(entry, MAX_ENTRY, tracks_fp)) {
/* Compare catalog number and copy entry if no match */
if (strncmp(current_cat, entry, cat_length) != 0)
fputs(entry, temp_fp);
}
fclose(tracks_fp);
fclose(temp_fp);

unlink(tracks_file);
rename(temp_file, tracks_file);
}

/*
remove_cd - delete the current CD from the database
*/
void remove_cd()
{
FILE *titles_fp, *temp_fp;
char entry[MAX_ENTRY];
int cat_length;

if (current_cd[0] == '\0')
return;

clear_all_screen();
mvprintw(PROMPT_LINE, 0, "About to remove CD %s: %s. ", current_cat, current_cd);
if (!get_confirm())
return;

cat_length = strlen(current_cat);

/* Copy the titles file to a temporary, ignoring this CD */
titles_fp = fopen(title_file, "r");
temp_fp = fopen(temp_file, "w");

while (fgets(entry, MAX_ENTRY, titles_fp)) {
/* Compare catalog number and copy entry if no match */
if (strncmp(current_cat, entry, cat_length) != 0)
fputs(entry, temp_fp);
}
fclose(titles_fp);
fclose(temp_fp);

/* Delete the titles file, and rename the temporary file */
unlink(title_file);
rename(temp_file, title_file);

/* Now do the same for the tracks file */
remove_tracks();

/* Reset current CD to 'None' */
current_cd[0] = '\0';
}


/*
Some defines we use only for showing or entering the track information
*/
#define BOXED_LINES 11
#define BOXED_ROWS 60
#define BOX_LINE_POS 8
#define BOX_ROW_POS 2
/*
list_tracks - list the tracks for the current CD
*/
void list_tracks()
{
FILE *tracks_fp;
char entry[MAX_ENTRY];
int cat_length;
int lines_op = 0;
WINDOW *track_pad_ptr;
int tracks = 0;
int key;
int first_line = 0;

if (current_cd[0] == '\0') {
mvprintw(ERROR_LINE, 0, "You must select a CD first. ", stdout);
get_return();
return;
}
clear_all_screen();
cat_length = strlen(current_cat);

/* First count the number of tracks for the current CD */
tracks_fp = fopen(tracks_file, "r");
if (!tracks_fp)
return;
while (fgets(entry, MAX_ENTRY, tracks_fp)) {
if (strncmp(current_cat, entry, cat_length) == 0)
tracks++;
}
fclose(tracks_fp);


/* Make a new pad, ensure that even if there is only a single
track the PAD is large enough so the later prefresh() is always
valid.
*/
track_pad_ptr = newpad(tracks + 1 + BOXED_LINES, BOXED_ROWS + 1);
if (!track_pad_ptr)
return;

tracks_fp = fopen(tracks_file, "r");
if (!tracks_fp)
return;

mvprintw(4, 0, "CD Track Listing\n");

/* write the track information into the pad */
while (fgets(entry, MAX_ENTRY, tracks_fp)) {
/* Compare catalog number and output rest of entry */
if (strncmp(current_cat, entry, cat_length) == 0) {
mvwprintw(track_pad_ptr, lines_op++, 0, "%s", entry + cat_length + 1);
}
}
fclose(tracks_fp);

if (lines_op > BOXED_LINES) {
mvprintw(MESSAGE_LINE, 0, "Cursor keys to scroll, RETURN or q to exit");
} else {
mvprintw(MESSAGE_LINE, 0, "RETURN or q to exit");
}
wrefresh(stdscr);
keypad(stdscr, TRUE);
cbreak();
noecho();

key = 0;
while (key != 'q' && key != KEY_ENTER && key != '\n') {
if (key == KEY_UP) {
if (first_line > 0)
first_line--;
}
if (key == KEY_DOWN) {
if (first_line + BOXED_LINES + 1 < tracks)
first_line++;
}
/* now draw the appropriate part of the pad on the screen */
prefresh(track_pad_ptr, first_line, 0,
BOX_LINE_POS, BOX_ROW_POS,
BOX_LINE_POS + BOXED_LINES, BOX_ROW_POS + BOXED_ROWS);
/* wrefresh(stdscr); */
key = getch();
}

delwin(track_pad_ptr);
keypad(stdscr, FALSE);
nocbreak();
echo();
}

/*
update_cd - re-enter tracks for current CD

deletes all tracks for the current CD in the database
and then prompts for new ones.
*/
void update_cd()
{
FILE *tracks_fp;
char track_name[MAX_STRING];
int len;
int track = 1;
int screen_line = 1;
WINDOW *box_window_ptr;
WINDOW *sub_window_ptr;

clear_all_screen();
mvprintw(PROMPT_LINE, 0, "Re-entering tracks for CD. ");
if (!get_confirm())
return;
move(PROMPT_LINE, 0);
clrtoeol();

remove_tracks();

mvprintw(MESSAGE_LINE, 0, "Enter a blank line to finish");

tracks_fp = fopen(tracks_file, "a");

/* Just to show how, enter the information in a scrolling, boxed,
window. The trick is to set-up a sub-window, draw a box around the
edge, then add a new, scrolling, sub-window just inside the boxed
sub-window. */
box_window_ptr = subwin(stdscr, BOXED_LINES + 2, BOXED_ROWS + 2,
BOX_LINE_POS - 1, BOX_ROW_POS - 1);
if (!box_window_ptr)
return;
box(box_window_ptr, ACS_VLINE, ACS_HLINE);

sub_window_ptr = subwin(stdscr, BOXED_LINES, BOXED_ROWS,
BOX_LINE_POS, BOX_ROW_POS);
if (!sub_window_ptr)
return;
scrollok(sub_window_ptr, TRUE);
werase(sub_window_ptr);
touchwin(stdscr);

do {

mvwprintw(sub_window_ptr, screen_line++, BOX_ROW_POS + 2, "Track %d: ", track);
clrtoeol();
refresh();
wgetnstr(sub_window_ptr, track_name, MAX_STRING);
len = strlen(track_name);
if (len > 0 && track_name[len - 1] == '\n')
track_name[len - 1] = '\0';

if (*track_name)
fprintf(tracks_fp, "%s,%d,%s\n", current_cat, track, track_name);
track++;
if (screen_line > BOXED_LINES - 1) {
/* time to start scrolling */
scroll(sub_window_ptr);
screen_line--;
}
} while (*track_name);
delwin(sub_window_ptr);

fclose(tracks_fp);
}

Weird huh

Cheers Nawg - Dec 13 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

Hi Thomas,

Just wanted to report that I've noticed that the appletbar's stipples don't have proper alignment with the kicker's stipples. This is noticeable whenever you use the option "Fade out applet handles" in the advanced options for the panel. This is with version 3.1.4 and the most recent and awesome version of Baghira. BTW; I've finally finished cleaning off the coffee I spit all over my monitor after laughing at your remark about the girls ;- P Hahahaha!

Is there a configure applet for Baghira? I can't find it anywhere in the control center.

Oh yeah, still look forward to "Ice sliders" with rounded or squared ends. You are difficult to influence aren't you;-) Thanx for your contributions to KDE.

Cheers,

Nawg - Dec 13 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

Hi,

Try it:

make distclean; make -f Makefile.cvs; sh configure --prefix=yourprefix; make

Should fix it for U.

Cheers,
Nawg - Dec 13 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

ROTFL!! That was so funny. You made me spit coffee all over my monitor. Hey, can't blame me for trying can ya? ;) Thanx for the tips. I'm gonna try it. Maybe I'll make a new spinoff called Baloo or something.

Cheers,
Nawg - Dec 11 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

Bingo! That's exactly what I meant. Rectangular ends. They would match much better with rect buttons. But the bevels would be the hardest part I think. How about "IceSliders" with rect ends Thomas.

Wouldn't that just be charming? Groovy dude! I thought I had already reported the problem with the artifacts, or at least I meant to tell about it. But you're ahead already once again ;-)

Rects are in. Rounds are out. Heheeee. Guys with Rects also get the girls in case you didn't know. I know a girl that gets all hot over rect liquid sliders.

Greetz,

Nawg - Dec 11 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

Dude you're the king. Rectangular sliders would really make this thing stand out and they will be the newest hype too ;-) Get with it. Get in touch with Mosfet about it if you need help. I'm still trying though. Hehehe; -) Awesome.

Greetz,

Nawg - Dec 10 2003
Come To Me...

Wallpaper Other by timbrown527 25 comments

I think it's nice. Maybe you could put the KDE logo above his head. I think he uses KDE anyway right? Couldn't possibly be a gnome user. Will you add the logo? Maybe you could do one with logo in the arms on a light blue background.

Cheers - Dec 10 2003
Baghira

KDE 3.5 Themes by thomas12777 1262 comments

No need to apologize about the rect buttons. I had actually found the code that I needed to adjust ;-) I think this last version is FANTASTIC! You've taken Baghira to the next level. Now point me to the code that deals with the bevel from the sliders. I'm gonna work on a rectangular option. The change from C to C++ is kicking my ass though.

Cheers,
Nawg - Dec 02 2003
Baghira SuSE 9.x RPM

KDE 3.5 Themes by Massive 154 comments

Thomas,

Thanks for your response. Well, maybe you could help me help myself by pointing me to the line of code that forms the button. I've have knowledge of C and have done a little C++ as well. I don' t just want to be someone who only request features. I would like to give it a try myself. Could you give me some tip? I think I need to look at the drawRectangularButton method?

What are IceButtons though? Maybe I will take a look at the slider code too ;-)

Cheers,
Nawg

ps> Are you from Austria? - Nov 24 2003
Baghira SuSE 9.x RPM

KDE 3.5 Themes by Massive 154 comments

Hi thomas12777,

First of all I wanna thank you for your great work on Baghira, taking high performance Liquid a step further. Sorry for giving someone else the credit.

Now, after having installed the Baghira on, I see that the location bar of Konqueror is looking great. It has the rectangular shape like the tabs. It would be incredible if the buttons like the ok buttons could also be squared up ( rectangular instead of oval ).

If you could achieve this, I think the theme would be even more professional than it already is. Maybe the scrollbars could have an option for a squared appearance too.

Overall the thems is extremely good. I thank you and mosfet.

Would it be difficult to make these modifications?

Cheers,
Nawg - Nov 23 2003
Baghira SuSE 9.x RPM

KDE 3.5 Themes by Massive 154 comments

Oh I see. Well I'll install it right now and compare it. Thanx,
Nawg - Nov 23 2003
Baghira SuSE 9.x RPM

KDE 3.5 Themes by Massive 154 comments

Hi Massive,

Would it be much work to make the buttons ( buttons like the ok button ) more rectangular which more matches the shape of the tabs? And also the location button of konqueror could be rectangular ( where you type in the urls ). This is something that has always irritated me with mosfet's liquid. I think this would make the theme professional and more consistent.

To give an example: In the first screenshot there is a button with "Knopf" on it. This button has an oval shape to it. Below the button "Knopf" you see "Kombinationsfeld". This button is more rectangular in shape. I think this rectangular shape is much more consistent with the rest of the theme items like tabs and progress-bars. Also I think the location-bar button on konqueror needs to have a rectangular shape. The scrollbars could have this shape as an option.

Cheers,
Nawg - Nov 23 2003
Baghira SuSE 9.x RPM

KDE 3.5 Themes by Massive 154 comments

Hi Massive,

Would it be much work to make the buttons ( buttons like the ok button ) more rectangular which more matches the shape of the tabs? And also the location button of konqueror could be rectangular ( where you type in the urls ). This is something that has always irritated me with mosfet's liquid. I think this would make the theme perfect and more consistent.

Cheers,
Nawg - Nov 23 2003
LINUX POWER BLACK

Wallpaper Other by pirke 3 comments

can't really make up my mind about which I like better; the black version or the blue. I think I'll use the black one for a while. The only critique I could give, which is of course based on personal preference, is that the elipses and juncture points could be made a little more subtle. Just a bit less bright. The Linux Power looks perfect the way it is.
Egg - Sep 04 2003
LINUX POWER BLACK

Wallpaper Other by pirke 3 comments

different. Simple but very nice.
Thanks,
Egg - Sep 04 2003
Plastik

KDE 3.0-3.4 Themes by ceebx 233 comments

Hi,

First of all, this is the most awesome style I've seen yet. I really love it. The one problem I have seen with it's use is that it causes Gideon (kdevelop 3) to segfault. This occurs once I create a project and hit "Finish".

This is the backtrace.
[New Thread 1098793344 (LWP 17931)]
[New Thread 1259724080 (LWP 17965)]
0xffffe002 in ?? ()
#0 0xffffe002 in ?? ()
#1 0x40b6ce1e in KCrash::defaultCrashHandler(int) ()
from /opt/kde3.1.3/lib/libkdecore.so.4
#2 0x4b2aa04c in QComboView::paintEvent(QPaintEvent*) ()
from /opt/kde3.1.3/lib/kde3/libkdevclassview.so

This only happens when using Plastik ;-(

Cheers,

Nawg - Aug 27 2003