Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-11-23 16:58:55 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-11-23 16:58:55 +0300
commit7b036e1dcb42f34020bff3d15071526b5d2cd479 (patch)
tree6608aee0a6397fc7735c2d183b3a8d1f8612182b /source/blender/windowmanager
parentfc1c411e2c43b7dc1641b7152076b85770e96f78 (diff)
Splash screen, implemented by Matt.
* Now has documentation links and recent files. * Click on image or outside splash to make it go away. * Still has old image, new one will be committed later.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c13
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c114
3 files changed, 126 insertions, 3 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index d4ba83b2886..a99c90e01a1 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -52,6 +52,8 @@ void WM_init (struct bContext *C);
void WM_exit (struct bContext *C);
void WM_main (struct bContext *C);
+void WM_init_splash (struct bContext *C);
+
void WM_check (struct bContext *C);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 06227086006..d5fe9d324c4 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -151,6 +151,19 @@ void WM_init(bContext *C)
read_Blog();
BLI_strncpy(G.lib, G.sce, FILE_MAX);
+
+}
+
+void WM_init_splash(bContext *C)
+{
+ wmWindowManager *wm= CTX_wm_manager(C);
+ wmWindow *prevwin= CTX_wm_window(C);
+
+ if(wm->windows.first) {
+ CTX_wm_window_set(C, wm->windows.first);
+ WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL);
+ CTX_wm_window_set(C, prevwin);
+ }
}
/* free strings of open recent files */
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 1b334bc778f..8eb980d0112 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -704,7 +704,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
block= uiBeginBlock(C, ar, "redo_popup", UI_EMBOSS);
uiBlockClearFlag(block, UI_BLOCK_LOOP);
- uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1);
+ uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
uiBlockSetHandleFunc(block, redo_cb, arg_op);
if(!op->properties) {
@@ -764,7 +764,7 @@ static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op)
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockClearFlag(block, UI_BLOCK_LOOP);
- uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1);
+ uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 300, 20, style);
uiItemL(layout, op->type->name, 0);
@@ -813,6 +813,71 @@ static void WM_OT_debug_menu(wmOperatorType *ot)
RNA_def_int(ot->srna, "debugval", 0, -10000, 10000, "Debug Value", "", INT_MIN, INT_MAX);
}
+
+/* ***************** Splash Screen ************************* */
+
+static void wm_block_splash_close(bContext *C, void *arg_block, void *arg_unused)
+{
+ uiPupBlockClose(C, arg_block);
+}
+
+static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused)
+{
+ uiBlock *block;
+ uiBut *but;
+ uiLayout *layout, *split, *col;
+ uiStyle *style= U.uistyles.first;
+
+ block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
+ uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1);
+
+ but= uiDefBut(block, BUT_IMAGE, 0, "", 0, 10, 501, 282, NULL, 0.0, 0.0, 0, 0, "");
+ uiButSetFunc(but, wm_block_splash_close, block, NULL);
+
+ uiBlockSetEmboss(block, UI_EMBOSSP);
+
+ layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 10, 10, 480, 110, style);
+
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
+
+ split = uiLayoutSplit(layout, 0);
+ col = uiLayoutColumn(split, 0);
+ uiItemL(col, "Links", 0);
+ uiItemO(col, NULL, ICON_URL, "HELP_OT_release_logs");
+ uiItemO(col, NULL, ICON_URL, "HELP_OT_manual");
+ uiItemO(col, NULL, ICON_URL, "HELP_OT_blender_website");
+ uiItemO(col, NULL, ICON_URL, "HELP_OT_user_community");
+ uiItemS(col);
+
+ col = uiLayoutColumn(split, 0);
+ uiItemL(col, "Recent", 0);
+ uiItemsEnumO(col, "WM_OT_open_recentfile_splash", "file");
+ uiItemS(col);
+
+ uiCenteredBoundsBlock(block, 0.0f);
+ uiEndBlock(C, block);
+
+ return block;
+}
+
+static int wm_splash_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ uiPupBlock(C, wm_block_create_splash, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+static void WM_OT_splash(wmOperatorType *ot)
+{
+ ot->name= "Splash Screen";
+ ot->idname= "WM_OT_splash";
+ ot->description= "Opens a blocking popup region with release info";
+
+ ot->invoke= wm_splash_invoke;
+ ot->poll= WM_operator_winactive;
+}
+
+
/* ***************** Search menu ************************* */
static void operator_call_cb(struct bContext *C, void *arg1, void *arg2)
{
@@ -858,7 +923,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op)
uiBut *but;
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1);
+ uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 180, 19, "");
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
@@ -1018,6 +1083,7 @@ static EnumPropertyItem *open_recentfile_itemf(bContext *C, PointerRNA *ptr, int
/* dynamically construct enum */
for(recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++) {
tmp.value= i+1;
+ tmp.icon= ICON_FILE_BLEND;
tmp.identifier= recent->filename;
tmp.name= BLI_short_filename(recent->filename);
RNA_enum_item_add(&item, &totitem, &tmp);
@@ -1047,6 +1113,45 @@ static void WM_OT_open_recentfile(wmOperatorType *ot)
RNA_def_enum_funcs(prop, open_recentfile_itemf);
}
+static EnumPropertyItem *open_recentfile_splash_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ EnumPropertyItem *item= NULL;
+ struct RecentFile *recent;
+ int totitem= 0, i;
+
+ /* dynamically construct enum */
+ for(recent = G.recent_files.first, i=0; (i<6) && (recent); recent = recent->next, i++) {
+ tmp.value= i+1;
+ tmp.icon= ICON_FILE_BLEND;
+ tmp.identifier= recent->filename;
+ tmp.name= BLI_last_slash(recent->filename)+1;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *free= 1;
+
+ return item;
+}
+
+static void WM_OT_open_recentfile_splash(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+ static EnumPropertyItem file_items[]= {
+ {0, NULL, 0, NULL, NULL}};
+
+ ot->name= "Open Recent File";
+ ot->idname= "WM_OT_open_recentfile_splash";
+ ot->description="Open recent files list.";
+
+ ot->exec= recentfile_exec;
+ ot->poll= WM_operator_winactive;
+
+ prop= RNA_def_enum(ot->srna, "file", file_items, 1, "File", "");
+ RNA_def_enum_funcs(prop, open_recentfile_splash_itemf);
+}
+
/* *************** open file **************** */
static void open_set_load_ui(wmOperator *op)
@@ -2464,6 +2569,7 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_window_fullscreen_toggle);
WM_operatortype_append(WM_OT_exit_blender);
WM_operatortype_append(WM_OT_open_recentfile);
+ WM_operatortype_append(WM_OT_open_recentfile_splash);
WM_operatortype_append(WM_OT_open_mainfile);
WM_operatortype_append(WM_OT_link_append);
WM_operatortype_append(WM_OT_recover_last_session);
@@ -2473,6 +2579,7 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_redraw_timer);
WM_operatortype_append(WM_OT_memory_statistics);
WM_operatortype_append(WM_OT_debug_menu);
+ WM_operatortype_append(WM_OT_splash);
WM_operatortype_append(WM_OT_search_menu);
WM_operatortype_append(WM_OT_call_menu);
@@ -2624,6 +2731,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
/* debug/testing */
WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
+ WM_keymap_verify_item(keymap, "WM_OT_splash", F1KEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_search_menu", SPACEKEY, KM_PRESS, 0, 0);
/* Space switching */