home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
root
/
usr
/
share
/
YaST2
/
include
/
x11
/
x11Dialog.ycp
< prev
Wrap
Text File
|
2006-11-29
|
6KB
|
218 lines
/**************
FILE : x11Dialog.ycp
***************
PROJECT : YaST2
:
AUTHOR : Marcus Schäfer <ms@suse.de>
:
BELONGS TO : YaST2 - Yet another Setup Tool
: (X11 integration part using libsax)
:
DESCRIPTION : UI part of the automatic X11 configuration
: Authors: Marcus Schäfer <ms@suse.de>
:
STATUS : Development
**************/
/**
* File: dialog/x11Dialog.ycp
* Package: X11 Configuration
* Summary: Popups for the X11 proposal
* Authors: Marcus Schaefer <ms@suse.de>
*
*/
{
textdomain "x11";
//================================
// Imports...
//--------------------------------
import "XMessages";
import "Popup";
//================================
// Popups
//--------------------------------
define void infoPopup () ``{
Popup::Message(XMessages::selectLink);
}
define void warnNoteBookPopup () ``{
Popup::Message(XMessages::warnNoteBook);
}
//================================
// setupColors
//--------------------------------
define string setupColors ( string currentText ) ``{
string space = " ";
string topic = XMessages::selectColorDepth + space;
UI::OpenDialog(
`VBox(
`HBox(`ComboBox(`id(`depth),`opt(`hstretch),topic,
[
`item(`id(`bit8), "256 [ 8 bit ]" ),
`item(`id(`bit15), "32768 [ 15 bit ]" ),
`item(`id(`bit16), "65536 [ 16 bit ]" ),
`item(`id(`bit24), "16.7 Mio. [ 24 Bit ]" )
]
)),
`Right (`HBox (
`PushButton(`id(`ok),"&OK"),
`PushButton(`id(`cancel),"&Cancel")
))
)
);
UI::ChangeWidget(`id(`depth), `Value, currentText);
any id = UI::UserInput();
if (id == `cancel) {
UI::CloseDialog();
if (currentText == "256 [ 8 bit ]") {
return "8";
}
if (currentText == "32768 [ 15 bit ]") {
return "15";
}
if (currentText == "65536 [ 16 bit ]") {
return "16";
}
if (currentText == "16.7 Mio. [ 24 Bit ]") {
return "24";
}
return "undef";
}
any col=UI::QueryWidget(`id(`depth), `Value);
UI::CloseDialog();
if ( col == `bit8 ) return "8";
if ( col == `bit15 ) return "15";
if ( col == `bit16 ) return "16";
if ( col == `bit24 ) return "24";
return "undef";
};
//================================
// setupResolutions
//--------------------------------
define string setupResolutions ( list reslist, string currentText ) ``{
string space = " ";
string topic = XMessages::selectResolution + space;
UI::OpenDialog(
`VBox(
`HBox(`Left ( `ComboBox(`id(`resitem),topic, reslist))),
`Right (`HBox (
`PushButton(`id(`ok),"&OK"),
`PushButton(`id(`cancel),"&Cancel")
))
)
);
UI::ChangeWidget(`id(`resitem), `Value, currentText);
any id = UI::UserInput();
if (id == `cancel) {
UI::CloseDialog();
return currentText;
}
any res=UI::QueryWidget(`id(`resitem), `Value);
UI::CloseDialog();
return (string)res;
};
//================================
// setupDisplaySize
//--------------------------------
define list<string> setupDisplaySize (
string currentTraversal, string currentRatios
) ``{
//string space = " ";
string topic1 = XMessages::selectDisplayTraversal;
string topic2 = XMessages::selectDisplayRatio;
list<string> traverlist = ["21","20","19","18.1","17","15.4","15","14.1","13.3","12.2"];
list<string> ratioslist = ["4/3","5/4","16/10"];
UI::OpenDialog(
`VBox(
`HBox(
`Left ( `ComboBox(`id(`traveritem),topic1, traverlist)),
`Right ( `ComboBox(`id(`ratiositem),topic2, ratioslist))
),
`Right (`HBox (
`PushButton(`id(`ok),"&OK"),
`PushButton(`id(`cancel),"&Cancel")
))
)
);
UI::ChangeWidget(`id(`traveritem), `Value, currentTraversal);
UI::ChangeWidget(`id(`ratiositem), `Value, currentRatios);
any id = UI::UserInput();
list<string> result = [];
if (id == `cancel) {
UI::CloseDialog();
result = add (result,currentTraversal);
result = add (result,currentRatios);
return result;
}
any traversal=UI::QueryWidget(`id(`traveritem), `Value);
any ratios=UI::QueryWidget(`id(`ratiositem), `Value);
result = add (result,(string)traversal);
result = add (result,(string)ratios);
UI::CloseDialog();
return result;
};
//================================
// setupMonitor
//--------------------------------
define list setupMonitor (
map<string,list> data, string currentVendor, string currentModel
) ``{
any id = nil;
list<string> result = [];
list<string> vendorList = [];
foreach (string vendor, list models, data, ``{
vendorList = vendorList + vendor;
});
UI::OpenDialog(
`VBox(
`HSpacing(70),
`Left (`Label(XMessages::selectMonitor)),
`HBox (
`VSpacing(20),
`SelectionBox(`id(`vendor),`opt(`notify,`immediate),"",vendorList),
`SelectionBox(`id(`model) ,`opt(`notify,`immediate),"", [])
),
`Right( `HBox (
`PushButton(`id(`ok),"&OK"),
`PushButton(`id(`cancel),"&Cancel")
))
)
);
list modelList = sort (data[currentVendor]:[]);
UI::ChangeWidget(`id(`vendor), `CurrentItem, currentVendor);
UI::ChangeWidget(`id(`model) , `Items, modelList);
UI::ChangeWidget(`id(`model) , `CurrentItem, currentModel);
any vendor = (string)currentVendor;
any model = (string)currentModel;
repeat {
id = UI::UserInput();
if (id == `vendor) {
vendor = UI::QueryWidget(`id(`vendor), `CurrentItem);
list modelList = sort (data[(string)vendor]:[]);
UI::ChangeWidget( `id( `model ), `Items, [] );
UI::ChangeWidget( `id( `model ), `Items, modelList );
}
if (id == `model) {
model = UI::QueryWidget(`id(`model), `CurrentItem);
}
if (id == `cancel) {
result[0] = (string)currentVendor;
result[1] = (string)currentModel;
UI::CloseDialog();
return result;
}
} until ( id == `ok );
UI::CloseDialog();
result[0] = (string)vendor;
result[1] = (string)model;
return result;
};
}