|
Lines 1-3
Link Here
|
|
|
1 |
#-------------------------------- Own functions -------------------------------- |
| 1 |
Window.GetMaxWidth = fun (){ |
2 |
Window.GetMaxWidth = fun (){ |
| 2 |
i = 0; |
3 |
i = 0; |
| 3 |
width = 800; # minimum |
4 |
width = 800; # minimum |
|
Lines 10-16
Window.GetMaxWidth = fun (){
Link Here
|
| 10 |
|
11 |
|
| 11 |
Window.GetMaxHeight = fun (){ |
12 |
Window.GetMaxHeight = fun (){ |
| 12 |
i = 0; |
13 |
i = 0; |
| 13 |
height = 600; # minium |
14 |
height = 600; # minimum |
| 14 |
while (Window.GetHeight(i)){ |
15 |
while (Window.GetHeight(i)){ |
| 15 |
height = Math.Max(height, Window.GetHeight(i)); |
16 |
height = Math.Max(height, Window.GetHeight(i)); |
| 16 |
i++; |
17 |
i++; |
|
Lines 18-23
Window.GetMaxHeight = fun (){
Link Here
|
| 18 |
return height; |
19 |
return height; |
| 19 |
}; |
20 |
}; |
| 20 |
|
21 |
|
|
|
22 |
Window.ComputeScaleFactor = fun(image_to_scale){ |
| 23 |
|
| 24 |
screen_ratio = Window.GetHeight() / Window.GetWidth(); |
| 25 |
image_ratio = image_to_scale.GetHeight() / image_to_scale.GetWidth(); |
| 26 |
|
| 27 |
if (screen_ratio > image_ratio) { |
| 28 |
# Screen ratio is taller than image ratio, we will match the screen height |
| 29 |
scale_factor = Window.GetHeight() / image_to_scale.GetHeight(); |
| 30 |
} |
| 31 |
else { |
| 32 |
# Screen ratio is wider than image ratio, we will match the screen width |
| 33 |
scale_factor = Window.GetWidth() / image_to_scale.GetWidth(); |
| 34 |
} |
| 35 |
|
| 36 |
return scale_factor; |
| 37 |
}; |
| 38 |
|
| 39 |
#--------------------------------------- Main ---------------------------------- |
| 21 |
|
40 |
|
| 22 |
if (Plymouth.GetMode() == "suspend" || Plymouth.GetMode() == "resume") { |
41 |
if (Plymouth.GetMode() == "suspend" || Plymouth.GetMode() == "resume") { |
| 23 |
background.original_image = ImageNew("suspend.png"); |
42 |
background.original_image = ImageNew("suspend.png"); |
|
Lines 46-53
else {
Link Here
|
| 46 |
|
65 |
|
| 47 |
} |
66 |
} |
| 48 |
|
67 |
|
| 49 |
# for now we just take the image as it is - no up or down scaling |
68 |
scale_factor = Window.ComputeScaleFactor(background.original_image) | 1; |
| 50 |
scale_factor = 1; |
|
|
| 51 |
|
69 |
|
| 52 |
background.image = background.original_image.Scale(background.original_image.GetWidth() * scale_factor, |
70 |
background.image = background.original_image.Scale(background.original_image.GetWidth() * scale_factor, |
| 53 |
background.original_image.GetHeight() * scale_factor); |
71 |
background.original_image.GetHeight() * scale_factor); |
|
Lines 76-82
if (Plymouth.GetMode() != "suspend" && Plymouth.GetMode() != "resume") {
Link Here
|
| 76 |
Plymouth.SetRefreshFunction (refresh_callback); |
94 |
Plymouth.SetRefreshFunction (refresh_callback); |
| 77 |
} |
95 |
} |
| 78 |
|
96 |
|
| 79 |
#----------------------------------------- Dialog -------------------------------- |
97 |
#----------------------------------------- Dialog ------------------------------ |
| 80 |
|
98 |
|
| 81 |
status = "normal"; |
99 |
status = "normal"; |
| 82 |
|
100 |
|
|
Lines 190-196
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Link Here
|
| 190 |
Plymouth.SetDisplayPasswordFunction(display_password_callback); |
208 |
Plymouth.SetDisplayPasswordFunction(display_password_callback); |
| 191 |
Plymouth.SetMessageFunction(display_message_callback); |
209 |
Plymouth.SetMessageFunction(display_message_callback); |
| 192 |
|
210 |
|
| 193 |
#----------------------------------------- Progress Bar -------------------------------- |
211 |
#----------------------------------------- Progress Bar ------------------------ |
| 194 |
|
212 |
|
| 195 |
if (Plymouth.GetMode() == "suspend" || Plymouth.GetMode() == "resume") { |
213 |
if (Plymouth.GetMode() == "suspend" || Plymouth.GetMode() == "resume") { |
| 196 |
progress_box.original_image = ImageNew("progress_box_background.png"); |
214 |
progress_box.original_image = ImageNew("progress_box_background.png"); |