Lines 16-21
Link Here
|
16 |
|
16 |
|
17 |
#include "stardict.h" |
17 |
#include "stardict.h" |
18 |
#include "conf.h" |
18 |
#include "conf.h" |
|
|
19 |
#include "utils.h" |
19 |
|
20 |
|
20 |
#include "mainwin.h" |
21 |
#include "mainwin.h" |
21 |
|
22 |
|
Lines 207-221
Link Here
|
207 |
|
208 |
|
208 |
void TopWin::ClearCallback(GtkWidget *widget, TopWin *oTopWin) |
209 |
void TopWin::ClearCallback(GtkWidget *widget, TopWin *oTopWin) |
209 |
{ |
210 |
{ |
210 |
if (conf->get_enable_sound_event()) { |
211 |
if (conf->get_enable_sound_event()) |
211 |
#ifdef _WIN32 |
212 |
play_wav_file((gStarDictDataDir+G_DIR_SEPARATOR+"sounds"+G_DIR_SEPARATOR+"buttonactive.wav").c_str()); |
212 |
gchar *filename = g_build_filename(stardict_data_dir, "sounds", "buttonactive.wav", NULL); |
213 |
|
213 |
PlaySound(filename, 0, SND_ASYNC | SND_FILENAME); |
|
|
214 |
g_free(filename); |
215 |
#else |
216 |
gnome_sound_play(STARDICT_DATA_DIR "/sounds/buttonactive.wav"); |
217 |
#endif |
218 |
} |
219 |
oTopWin->InsertHisList(oTopWin->GetText()); |
214 |
oTopWin->InsertHisList(oTopWin->GetText()); |
220 |
oTopWin->InsertBackList(); |
215 |
oTopWin->InsertBackList(); |
221 |
oTopWin->SetText(""); |
216 |
oTopWin->SetText(""); |
Lines 224-238
Link Here
|
224 |
|
219 |
|
225 |
void TopWin::GoCallback(GtkWidget *widget, TopWin *oTopWin) |
220 |
void TopWin::GoCallback(GtkWidget *widget, TopWin *oTopWin) |
226 |
{ |
221 |
{ |
227 |
if (conf->get_enable_sound_event()) { |
222 |
if (conf->get_enable_sound_event()) |
228 |
#ifdef _WIN32 |
223 |
play_wav_file((gStarDictDataDir+G_DIR_SEPARATOR+"sounds"+G_DIR_SEPARATOR+"buttonactive.wav").c_str()); |
229 |
gchar *filename = g_build_filename(stardict_data_dir, "sounds", "buttonactive.wav", NULL); |
224 |
|
230 |
PlaySound(filename, 0, SND_ASYNC | SND_FILENAME); |
|
|
231 |
g_free(filename); |
232 |
#else |
233 |
gnome_sound_play(STARDICT_DATA_DIR "/sounds/buttonactive.wav"); |
234 |
#endif |
235 |
} |
236 |
const gchar *text = oTopWin->GetText(); |
225 |
const gchar *text = oTopWin->GetText(); |
237 |
if (text[0]=='\0') |
226 |
if (text[0]=='\0') |
238 |
return; |
227 |
return; |
Lines 276-290
Link Here
|
276 |
|
265 |
|
277 |
void TopWin::BackCallback(GtkWidget *widget, TopWin *oTopWin) |
266 |
void TopWin::BackCallback(GtkWidget *widget, TopWin *oTopWin) |
278 |
{ |
267 |
{ |
279 |
if (conf->get_enable_sound_event()) { |
268 |
if (conf->get_enable_sound_event()) |
280 |
#ifdef _WIN32 |
269 |
play_wav_file((gStarDictDataDir+G_DIR_SEPARATOR+"sounds"+G_DIR_SEPARATOR+"buttonactive.wav").c_str()); |
281 |
gchar *filename = g_build_filename(stardict_data_dir, "sounds", "buttonactive.wav", NULL); |
270 |
|
282 |
PlaySound(filename, 0, SND_ASYNC | SND_FILENAME); |
|
|
283 |
g_free(filename); |
284 |
#else |
285 |
gnome_sound_play(STARDICT_DATA_DIR "/sounds/buttonactive.wav"); |
286 |
#endif |
287 |
} |
288 |
oTopWin->do_back(); |
271 |
oTopWin->do_back(); |
289 |
} |
272 |
} |
290 |
|
273 |
|
Lines 348-362
Link Here
|
348 |
|
331 |
|
349 |
void TopWin::PreviousCallback(GtkWidget *widget, TopWin *oTopWin) |
332 |
void TopWin::PreviousCallback(GtkWidget *widget, TopWin *oTopWin) |
350 |
{ |
333 |
{ |
351 |
if (conf->get_enable_sound_event()) { |
334 |
if (conf->get_enable_sound_event()) |
352 |
#ifdef _WIN32 |
335 |
play_wav_file((gStarDictDataDir+G_DIR_SEPARATOR+"sounds"+G_DIR_SEPARATOR+"buttonactive.wav").c_str()); |
353 |
gchar *filename = g_build_filename(stardict_data_dir, "sounds", "buttonactive.wav", NULL); |
336 |
|
354 |
PlaySound(filename, 0, SND_ASYNC | SND_FILENAME); |
|
|
355 |
g_free(filename); |
356 |
#else |
357 |
gnome_sound_play(STARDICT_DATA_DIR "/sounds/buttonactive.wav"); |
358 |
#endif |
359 |
} |
360 |
oTopWin->do_previous(); |
337 |
oTopWin->do_previous(); |
361 |
} |
338 |
} |
362 |
|
339 |
|
Lines 428-442
Link Here
|
428 |
|
405 |
|
429 |
void TopWin::NextCallback(GtkWidget *widget, TopWin *oTopWin) |
406 |
void TopWin::NextCallback(GtkWidget *widget, TopWin *oTopWin) |
430 |
{ |
407 |
{ |
431 |
if (conf->get_enable_sound_event()) { |
408 |
if (conf->get_enable_sound_event()) |
432 |
#ifdef _WIN32 |
409 |
play_wav_file((gStarDictDataDir+G_DIR_SEPARATOR+"sounds"+G_DIR_SEPARATOR+"buttonactive.wav").c_str()); |
433 |
gchar *filename = g_build_filename(stardict_data_dir, "sounds", "buttonactive.wav", NULL); |
410 |
|
434 |
PlaySound(filename, 0, SND_ASYNC | SND_FILENAME); |
|
|
435 |
g_free(filename); |
436 |
#else |
437 |
gnome_sound_play(STARDICT_DATA_DIR "/sounds/buttonactive.wav"); |
438 |
#endif |
439 |
} |
440 |
oTopWin->do_next(); |
411 |
oTopWin->do_next(); |
441 |
} |
412 |
} |
442 |
|
413 |
|
Lines 452-473
Link Here
|
452 |
|
423 |
|
453 |
void TopWin::on_main_menu_newversion_activate(GtkMenuItem *menuitem, TopWin *oTopWin) |
424 |
void TopWin::on_main_menu_newversion_activate(GtkMenuItem *menuitem, TopWin *oTopWin) |
454 |
{ |
425 |
{ |
455 |
#ifdef _WIN32 |
426 |
show_url("http://stardict.sourceforge.net"); |
456 |
ShellExecute((HWND)(GDK_WINDOW_HWND(gpAppFrame->oAppCore.window->window)), "OPEN", "http://stardict.sourceforge.net", NULL, NULL, SW_SHOWNORMAL); |
|
|
457 |
#else |
458 |
gnome_url_show("http://stardict.sourceforge.net", NULL); |
459 |
#endif |
460 |
} |
427 |
} |
461 |
|
428 |
|
462 |
void TopWin::on_main_menu_help_activate(GtkMenuItem *menuitem, TopWin *oTopWin) |
429 |
void TopWin::on_main_menu_help_activate(GtkMenuItem *menuitem, TopWin *oTopWin) |
463 |
{ |
430 |
{ |
464 |
#ifdef _WIN32 |
431 |
show_help(NULL); |
465 |
gchar *filename = g_strdup_printf(_("file:///%s/help/C/stardict.html"), stardict_data_dir); |
|
|
466 |
ShellExecute((HWND)(GDK_WINDOW_HWND(gpAppFrame->oAppCore.window->window)), "OPEN", filename, NULL, NULL, SW_SHOWNORMAL); |
467 |
g_free(filename); |
468 |
#else |
469 |
gnome_help_display ("stardict.xml", NULL, NULL); |
470 |
#endif |
471 |
} |
432 |
} |
472 |
|
433 |
|
473 |
void TopWin::on_main_menu_about_activate(GtkMenuItem *menuitem, TopWin *oTopWin) |
434 |
void TopWin::on_main_menu_about_activate(GtkMenuItem *menuitem, TopWin *oTopWin) |
Lines 510-524
Link Here
|
510 |
|
471 |
|
511 |
void TopWin::do_menu() |
472 |
void TopWin::do_menu() |
512 |
{ |
473 |
{ |
513 |
if (conf->get_enable_sound_event()) { |
474 |
if (conf->get_enable_sound_event()) |
514 |
#ifdef _WIN32 |
475 |
play_wav_file((gStarDictDataDir+G_DIR_SEPARATOR+"sounds"+G_DIR_SEPARATOR+"menushow.wav").c_str()); |
515 |
gchar *filename = g_build_filename(stardict_data_dir, "sounds", "menushow.wav", NULL); |
476 |
|
516 |
PlaySound(filename, 0, SND_ASYNC | SND_FILENAME); |
|
|
517 |
g_free(filename); |
518 |
#else |
519 |
gnome_sound_play(STARDICT_DATA_DIR "/sounds/menushow.wav"); |
520 |
#endif |
521 |
} |
522 |
if (!MainMenu) { |
477 |
if (!MainMenu) { |
523 |
MainMenu = gtk_menu_new(); |
478 |
MainMenu = gtk_menu_new(); |
524 |
|
479 |
|
Lines 855-861
Link Here
|
855 |
|
810 |
|
856 |
void TreeWin::Create(GtkWidget *notebook) |
811 |
void TreeWin::Create(GtkWidget *notebook) |
857 |
{ |
812 |
{ |
858 |
GtkTreeStore *model = gpAppFrame->oAppCore.oTreeDicts.Load(conf->get_treedict_order_list(), |
813 |
GtkTreeStore *model = gpAppFrame->oAppCore.oTreeDicts.Load((gStarDictDataDir+G_DIR_SEPARATOR+"treedict").c_str(), |
|
|
814 |
conf->get_treedict_order_list(), |
859 |
conf->get_treedict_disable_list()); |
815 |
conf->get_treedict_disable_list()); |
860 |
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL(model)); |
816 |
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL(model)); |
861 |
gtk_widget_show(treeview); |
817 |
gtk_widget_show(treeview); |
Lines 1736-1764
Link Here
|
1736 |
|
1692 |
|
1737 |
void BottomWin::AboutCallback(GtkButton *button, gpointer data) |
1693 |
void BottomWin::AboutCallback(GtkButton *button, gpointer data) |
1738 |
{ |
1694 |
{ |
1739 |
if (conf->get_enable_sound_event()) { |
1695 |
if (conf->get_enable_sound_event()) |
1740 |
#ifdef _WIN32 |
1696 |
play_wav_file((gStarDictDataDir+G_DIR_SEPARATOR+"sounds"+G_DIR_SEPARATOR+"buttonactive.wav").c_str()); |
1741 |
gchar *filename = g_build_filename(stardict_data_dir, "sounds", "buttonactive.wav", NULL); |
1697 |
|
1742 |
PlaySound(filename, 0, SND_ASYNC | SND_FILENAME); |
|
|
1743 |
g_free(filename); |
1744 |
#else |
1745 |
gnome_sound_play(STARDICT_DATA_DIR "/sounds/buttonactive.wav"); |
1746 |
#endif |
1747 |
} |
1748 |
gpAppFrame->oAppCore.oMidWin.oTextWin.ShowInfo(); |
1698 |
gpAppFrame->oAppCore.oMidWin.oTextWin.ShowInfo(); |
1749 |
} |
1699 |
} |
1750 |
|
1700 |
|
1751 |
void BottomWin::QuitCallback(GtkButton *button, gpointer data) |
1701 |
void BottomWin::QuitCallback(GtkButton *button, gpointer data) |
1752 |
{ |
1702 |
{ |
1753 |
if (conf->get_enable_sound_event()) { |
1703 |
if (conf->get_enable_sound_event()) |
1754 |
#ifdef _WIN32 |
1704 |
play_wav_file((gStarDictDataDir+G_DIR_SEPARATOR+"sounds"+G_DIR_SEPARATOR+"buttonactive.wav").c_str()); |
1755 |
gchar *filename = g_build_filename(stardict_data_dir, "sounds", "buttonactive.wav", NULL); |
1705 |
|
1756 |
PlaySound(filename, 0, SND_ASYNC | SND_FILENAME); |
|
|
1757 |
g_free(filename); |
1758 |
#else |
1759 |
gnome_sound_play(STARDICT_DATA_DIR "/sounds/buttonactive.wav"); |
1760 |
#endif |
1761 |
} |
1762 |
gpAppFrame->Quit(); |
1706 |
gpAppFrame->Quit(); |
1763 |
} |
1707 |
} |
1764 |
|
1708 |
|
Lines 1808-1829
Link Here
|
1808 |
const gchar *text; |
1752 |
const gchar *text; |
1809 |
text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(gpAppFrame->oAppCore.oTopWin.WordCombo)->entry)); |
1753 |
text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(gpAppFrame->oAppCore.oTopWin.WordCombo)->entry)); |
1810 |
if (text[0]) { |
1754 |
if (text[0]) { |
1811 |
gchar *url; |
1755 |
gchar *url = g_strdup_printf(website_searchlink+1,text); |
1812 |
url = g_strdup_printf(website_searchlink+1,text); |
1756 |
show_url(url); |
1813 |
#ifdef _WIN32 |
|
|
1814 |
ShellExecute((HWND)(GDK_WINDOW_HWND(gpAppFrame->oAppCore.window->window)), "OPEN", url, NULL, NULL, SW_SHOWNORMAL); |
1815 |
#else |
1816 |
gnome_url_show(url, NULL); |
1817 |
#endif |
1818 |
g_free(url); |
1757 |
g_free(url); |
1819 |
} |
1758 |
} else |
1820 |
else { |
1759 |
show_url(website_link+1); |
1821 |
#ifdef _WIN32 |
1760 |
|
1822 |
ShellExecute((HWND)(GDK_WINDOW_HWND(gpAppFrame->oAppCore.window->window)), "OPEN", website_link+1, NULL, NULL, SW_SHOWNORMAL); |
|
|
1823 |
#else |
1824 |
gnome_url_show(website_link+1, NULL); |
1825 |
#endif |
1826 |
} |
1827 |
*website_link = '\t'; |
1761 |
*website_link = '\t'; |
1828 |
*website_searchlink = '\t'; |
1762 |
*website_searchlink = '\t'; |
1829 |
} |
1763 |
} |
Lines 1846-1878
Link Here
|
1846 |
const gchar *text; |
1780 |
const gchar *text; |
1847 |
text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(gpAppFrame->oAppCore.oTopWin.WordCombo)->entry)); |
1781 |
text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(gpAppFrame->oAppCore.oTopWin.WordCombo)->entry)); |
1848 |
if (text[0]) { |
1782 |
if (text[0]) { |
1849 |
gchar *url; |
1783 |
gchar *url = g_strdup_printf(website_searchlink+1, text); |
1850 |
url = g_strdup_printf(website_searchlink+1,text); |
1784 |
show_url(url); |
1851 |
#ifdef _WIN32 |
|
|
1852 |
ShellExecute((HWND)(GDK_WINDOW_HWND(gpAppFrame->oAppCore.window->window)), "OPEN", url, NULL, NULL, SW_SHOWNORMAL); |
1853 |
#else |
1854 |
gnome_url_show(url, NULL); |
1855 |
#endif |
1856 |
g_free(url); |
1785 |
g_free(url); |
1857 |
} |
1786 |
} else |
1858 |
else { |
1787 |
show_url(website_link+1); |
1859 |
#ifdef _WIN32 |
1788 |
|
1860 |
ShellExecute((HWND)(GDK_WINDOW_HWND(gpAppFrame->oAppCore.window->window)), "OPEN", website_link+1, NULL, NULL, SW_SHOWNORMAL); |
|
|
1861 |
#else |
1862 |
gnome_url_show(website_link+1, NULL); |
1863 |
#endif |
1864 |
} |
1865 |
*website_link = '\t'; |
1789 |
*website_link = '\t'; |
1866 |
*website_searchlink = '\t'; |
1790 |
*website_searchlink = '\t'; |
1867 |
} |
1791 |
} |
1868 |
|
1792 |
|
1869 |
void BottomWin::NewVersionCallback(GtkButton *button, BottomWin *oBottomWin) |
1793 |
void BottomWin::NewVersionCallback(GtkButton *button, BottomWin *oBottomWin) |
1870 |
{ |
1794 |
{ |
1871 |
#ifdef _WIN32 |
1795 |
show_url("http://stardict.sourceforge.net"); |
1872 |
ShellExecute((HWND)(GDK_WINDOW_HWND(gpAppFrame->oAppCore.window->window)), "OPEN", "http://stardict.sourceforge.net", NULL, NULL, SW_SHOWNORMAL); |
|
|
1873 |
#else |
1874 |
gnome_url_show("http://stardict.sourceforge.net", NULL); |
1875 |
#endif |
1876 |
} |
1796 |
} |
1877 |
|
1797 |
|
1878 |
void BottomWin::DictManageCallback(GtkButton *button, BottomWin *oBottomWin) |
1798 |
void BottomWin::DictManageCallback(GtkButton *button, BottomWin *oBottomWin) |