// Copyright (C) 2017 - AGH - Wojciech T. Witkowski
//
// Date of creation: 2017-05-15
//
function main

    clc;
    f_w = 300; f_h = 650;
    p_w = 900; p_h = 750;
    m_x = 15; m_y = 15; 
    
    a_w = 50 + f_w + p_w;
    a_h = 30 + f_h;
    defaultfont = "arial";
    
    gui = scf(101);
    gui.background = -2;
    gui.figure_position = [100 100];
    gui.figure_name = gettext("SubCom_v1.0");
    gui.axes_size = [a_w a_h];

    delmenu(gui.figure_id,gettext("&File"));
    delmenu(gui.figure_id,gettext("&Tools"));
    delmenu(gui.figure_id,gettext("&Edit"));
    delmenu(gui.figure_id,gettext("&?"));
    toolbar(gui.figure_id,"off");

    han = uimenu("parent",gui, "label",gettext("Info"));
    
    uimenu("parent",han, "label",gettext("About"), "callback","infoSubCom()");
    sleep(50);
    
    // Settings

    new_f = uicontrol("parent",gui, "relief","groove", ...
    "style","frame", "units","pixels", ...
    "position",[ m_x m_y+430 f_w f_h-430], ...
    "horizontalalignment","center", "background",[1 1 1], ...
    "tag","frame_control");
    new_f_title = uicontrol("parent",gui, "style","text", ...
    "string","Settings", "units","pixels", ...
    "position",[30+m_x m_y+f_h-10 f_w-60 20],...
    "fontname",defaultfont, "fontunits","points", ...
    "fontsize",16, "horizontalalignment","center", ...
    "background",[1 1 1], "tag","title_frame_control");

    uicontrol("parent",gui, "style","text",...
    "string","Aquifer:", "position",[40, f_w+310, 100, 25], ...
    "horizontalalignment","left", "fontsize",14, ...
    "background",[1 1 1]);
    guientry1 = uicontrol("parent",gui, "style","edit",...
    "string","DATA/Aquifer.txt", "position",[150, f_w+310,140,25], ...
    "horizontalalignment","left", "fontsize",14, ...
    "background",[.8 .9 .9], "tag","Aquifer:");

    uicontrol("parent",gui, "style","text",...
    "string","Profile:", "position",[40, f_w+280,100,25], ...
    "horizontalalignment","left", "fontsize",14, ...
    "background",[1 1 1]);
    guientry2 = uicontrol("parent",gui, "style","edit",...
    "string","DATA/Profile.txt", "position",[150, f_w+280,140,25], ...
    "horizontalalignment","left", "fontsize",14, ...
    "background",[.8 .9 .9], "tag","Profile:");
    
    guihan = 450;
    guihanw = 80;
    labels = ["$C_{m} [{MPa}^{-1}]:$", "$tg\beta [-]:$", "No. Iterations:"];
    values = ["0.0009", "0.10", "5"];
    l1 = 40; l2 = 100; l3 = 150;

    for k=1:size(labels,2)
        uicontrol("parent",gui, "style","text", ...
        "string",labels(k), "position",[l1,guihan-k*25+guihanw+10,l2,20], ...
        "horizontalalignment","left", "fontsize",12, ...
        "background",[1 1 1]);
        guientry2(k) = uicontrol("parent",gui, "style","edit",...
        "string",values(k), "position",[l3,guihan-k*25+guihanw+10,140,20], ...
        "horizontalalignment","left", "fontsize",14, ...
        "background",[.8 .9 .8], "tag",labels(k));
    end;

    //Computations

    new_f2 = uicontrol("parent",gui, "relief","groove", ...
    "style","frame", "units","pixels", ...
    "position",[ m_x m_y f_w f_h-250], ...
    "horizontalalignment","center", "background",[1 1 1], ...
    "tag","frame_control");
    new_f2_title = uicontrol("parent",gui, "style","text", ...
    "string","Computations", "units","pixels", ...
    "position",[30+m_x m_y+385 f_w-60 20],...
    "fontname",defaultfont, "fontunits","points", ...
    "fontsize",16, "horizontalalignment","center", ...
    "background",[1 1 1], "tag","title_frame_control");
    
    button1 = uicontrol(gui, "style","pushbutton", ...
    "Position",[85 300 150 40], "String","Draw data", ...
    "BackgroundColor",[.9 .9 .9], "fontsize",14, ...
    "Callback","drawdata");
    button2 = uicontrol(gui, "style","pushbutton", ...
    "Position",[85 200 150 40], "String","1-Iteration", ...
    "BackgroundColor",[.9 .9 .9], "fontsize",14, ...
    "Callback","calculation(1)");
    drawbutton3 = uicontrol(gui, "style","pushbutton", ...
    "Position",[85 100 150 40], "String","Calculations", ...
    "BackgroundColor",[.8 .9 .9], "fontsize",16, "fontweight", "bold", ...
    "Callback","calculation(2)");

endfunction
