#include "MailReact.h"
#include "TextEdit.H"
#include "sfl.h"
#include "resource.h"
#include <FL/x.H>


char *
ini_dyn_assumevalue (
    SYMTAB *symtab,
    const char *section,
    const char *keyword,
    const char *default_value)
{
	char ini_keyword2[LINE_MAX + 1];
    char *getval;
	abortit=FALSE;

	ASSERT (section);
    if (keyword && *keyword)
        sprintf (ini_keyword2, "%s:%s", section, keyword);
    else
        strcpy  (ini_keyword2, section);

    strlwc (ini_keyword2);
	getval=(sym_get_value (symtab, ini_keyword2, default_value));
	if(strcmp(getval,default_value)==0)
	{
	sym_assume_symbol(symtab,ini_keyword2,default_value);
	}
	return getval;

}


void ini_dyn_setvalue(SYMTAB *symtab,
	const char *section,
	const char *keyword,
    const char *value)
{
    char ini_keyword2[LINE_MAX + 1];
	ASSERT (section);
	    if (keyword && *keyword)
        sprintf (ini_keyword2, "%s:%s", section, keyword);
    else
        strcpy  (ini_keyword2, section);
	   strlwc (ini_keyword2);

	SYMBOL *mysym=sym_lookup_symbol (symtab,ini_keyword2);
	if(mysym)sym_set_value (mysym,value);
	else 	sym_create_symbol(symtab,ini_keyword2,value);
}

SYMTAB load_symtab;

int main(int argc, char **argv) {
ini_dyn_load (&load_symtab,"MailReactor.ini");
	Fl_Window* window=make_window();

#ifdef WIN32
	window->icon((char *)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON),IMAGE_ICON,16,16,LR_DEFAULTSIZE));
#else
// #include "icon.xpm"

// Pixmap p = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
//                                 *icon, 32, 32);

// window->icon((char *)p);

#endif
	window->show();

	//		window->size_range( 200, 300, 0, 0 );
//	d.MoveDown();
	Fl::run();
	ini_dyn_save (&load_symtab,"MailReactor.ini");
  return 1;
}
