diff options
-rw-r--r-- | src/ui/documentwidget.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 827e2810..b56e9be8 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -143,7 +143,7 @@ struct Impl_OutlineItem { | |||
143 | 143 | ||
144 | /*----------------------------------------------------------------------------------------------*/ | 144 | /*----------------------------------------------------------------------------------------------*/ |
145 | 145 | ||
146 | static void animatePlayingAudio_DocumentWidget_(iDocumentWidget *d); | 146 | static void animatePlayers_DocumentWidget_(iDocumentWidget *d); |
147 | 147 | ||
148 | static const int smoothSpeed_DocumentWidget_ = 120; /* unit: gap_Text per second */ | 148 | static const int smoothSpeed_DocumentWidget_ = 120; /* unit: gap_Text per second */ |
149 | static const int outlineMinWidth_DocumentWdiget_ = 45; /* times gap_UI */ | 149 | static const int outlineMinWidth_DocumentWdiget_ = 45; /* times gap_UI */ |
@@ -482,7 +482,7 @@ static uint32_t postPlayerUpdate_DocumentWidget_(uint32_t interval, void *contex | |||
482 | return interval; | 482 | return interval; |
483 | } | 483 | } |
484 | 484 | ||
485 | static void updateAudioPlayers_DocumentWidget_(iDocumentWidget *d) { | 485 | static void updatePlayers_DocumentWidget_(iDocumentWidget *d) { |
486 | if (document_App() == d) { | 486 | if (document_App() == d) { |
487 | refresh_Widget(d); | 487 | refresh_Widget(d); |
488 | iConstForEach(PtrArray, i, &d->visiblePlayers) { | 488 | iConstForEach(PtrArray, i, &d->visiblePlayers) { |
@@ -500,7 +500,7 @@ static void updateAudioPlayers_DocumentWidget_(iDocumentWidget *d) { | |||
500 | } | 500 | } |
501 | } | 501 | } |
502 | 502 | ||
503 | static void animatePlayingAudio_DocumentWidget_(iDocumentWidget *d) { | 503 | static void animatePlayers_DocumentWidget_(iDocumentWidget *d) { |
504 | if (document_App() != d) { | 504 | if (document_App() != d) { |
505 | if (d->playerTimer) { | 505 | if (d->playerTimer) { |
506 | SDL_RemoveTimer(d->playerTimer); | 506 | SDL_RemoveTimer(d->playerTimer); |
@@ -528,7 +528,7 @@ static void updateVisible_DocumentWidget_(iDocumentWidget *d) { | |||
528 | render_GmDocument(d->doc, visRange, addVisible_DocumentWidget_, d); | 528 | render_GmDocument(d->doc, visRange, addVisible_DocumentWidget_, d); |
529 | updateHover_DocumentWidget_(d, mouseCoord_Window(get_Window())); | 529 | updateHover_DocumentWidget_(d, mouseCoord_Window(get_Window())); |
530 | updateSideOpacity_DocumentWidget_(d, iTrue); | 530 | updateSideOpacity_DocumentWidget_(d, iTrue); |
531 | animatePlayingAudio_DocumentWidget_(d); | 531 | animatePlayers_DocumentWidget_(d); |
532 | /* Remember scroll positions of recently visited pages. */ { | 532 | /* Remember scroll positions of recently visited pages. */ { |
533 | iRecentUrl *recent = mostRecentUrl_History(d->mod.history); | 533 | iRecentUrl *recent = mostRecentUrl_History(d->mod.history); |
534 | if (recent && docSize && d->state == ready_RequestState) { | 534 | if (recent && docSize && d->state == ready_RequestState) { |
@@ -1257,7 +1257,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1257 | updateOutlineOpacity_DocumentWidget_(d); | 1257 | updateOutlineOpacity_DocumentWidget_(d); |
1258 | updateWindowTitle_DocumentWidget_(d); | 1258 | updateWindowTitle_DocumentWidget_(d); |
1259 | allocVisBuffer_DocumentWidget_(d); | 1259 | allocVisBuffer_DocumentWidget_(d); |
1260 | animatePlayingAudio_DocumentWidget_(d); | 1260 | animatePlayers_DocumentWidget_(d); |
1261 | return iFalse; | 1261 | return iFalse; |
1262 | } | 1262 | } |
1263 | else if (equal_Command(cmd, "server.showcert") && d == document_App()) { | 1263 | else if (equal_Command(cmd, "server.showcert") && d == document_App()) { |
@@ -1391,7 +1391,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1391 | } | 1391 | } |
1392 | } | 1392 | } |
1393 | else if (equal_Command(cmd, "media.player.update")) { | 1393 | else if (equal_Command(cmd, "media.player.update")) { |
1394 | updateAudioPlayers_DocumentWidget_(d); | 1394 | updatePlayers_DocumentWidget_(d); |
1395 | return iFalse; | 1395 | return iFalse; |
1396 | } | 1396 | } |
1397 | else if (equal_Command(cmd, "document.stop") && document_App() == d) { | 1397 | else if (equal_Command(cmd, "document.stop") && document_App() == d) { |
@@ -1586,7 +1586,7 @@ static size_t visibleLinkOrdinal_DocumentWidget_(const iDocumentWidget *d, iGmLi | |||
1586 | return iInvalidPos; | 1586 | return iInvalidPos; |
1587 | } | 1587 | } |
1588 | 1588 | ||
1589 | static iRect audioPlayerRect_DocumentWidget_(const iDocumentWidget *d, const iGmRun *run) { | 1589 | static iRect playerRect_DocumentWidget_(const iDocumentWidget *d, const iGmRun *run) { |
1590 | const iRect docBounds = documentBounds_DocumentWidget_(d); | 1590 | const iRect docBounds = documentBounds_DocumentWidget_(d); |
1591 | return moved_Rect(run->bounds, addY_I2(topLeft_Rect(docBounds), -d->scrollY)); | 1591 | return moved_Rect(run->bounds, addY_I2(topLeft_Rect(docBounds), -d->scrollY)); |
1592 | } | 1592 | } |
@@ -1612,7 +1612,7 @@ static void setGrabbedPlayer_DocumentWidget_(iDocumentWidget *d, const iGmRun *r | |||
1612 | } | 1612 | } |
1613 | } | 1613 | } |
1614 | 1614 | ||
1615 | static iBool processAudioPlayerEvents_DocumentWidget_(iDocumentWidget *d, const SDL_Event *ev) { | 1615 | static iBool processPlayerEvents_DocumentWidget_(iDocumentWidget *d, const SDL_Event *ev) { |
1616 | if (ev->type != SDL_MOUSEBUTTONDOWN && ev->type != SDL_MOUSEBUTTONUP && | 1616 | if (ev->type != SDL_MOUSEBUTTONDOWN && ev->type != SDL_MOUSEBUTTONUP && |
1617 | ev->type != SDL_MOUSEMOTION) { | 1617 | ev->type != SDL_MOUSEMOTION) { |
1618 | return iFalse; | 1618 | return iFalse; |
@@ -1629,7 +1629,7 @@ static iBool processAudioPlayerEvents_DocumentWidget_(iDocumentWidget *d, const | |||
1629 | const iInt2 mouse = init_I2(ev->button.x, ev->button.y); | 1629 | const iInt2 mouse = init_I2(ev->button.x, ev->button.y); |
1630 | iConstForEach(PtrArray, i, &d->visiblePlayers) { | 1630 | iConstForEach(PtrArray, i, &d->visiblePlayers) { |
1631 | const iGmRun *run = i.ptr; | 1631 | const iGmRun *run = i.ptr; |
1632 | const iRect rect = audioPlayerRect_DocumentWidget_(d, run); | 1632 | const iRect rect = playerRect_DocumentWidget_(d, run); |
1633 | iPlayer * plr = audioPlayer_Media(media_GmDocument(d->doc), run->audioId); | 1633 | iPlayer * plr = audioPlayer_Media(media_GmDocument(d->doc), run->audioId); |
1634 | if (contains_Rect(rect, mouse)) { | 1634 | if (contains_Rect(rect, mouse)) { |
1635 | iPlayerUI ui; | 1635 | iPlayerUI ui; |
@@ -1651,7 +1651,7 @@ static iBool processAudioPlayerEvents_DocumentWidget_(iDocumentWidget *d, const | |||
1651 | } | 1651 | } |
1652 | if (contains_Rect(ui.playPauseRect, mouse)) { | 1652 | if (contains_Rect(ui.playPauseRect, mouse)) { |
1653 | setPaused_Player(plr, !isPaused_Player(plr)); | 1653 | setPaused_Player(plr, !isPaused_Player(plr)); |
1654 | animatePlayingAudio_DocumentWidget_(d); | 1654 | animatePlayers_DocumentWidget_(d); |
1655 | return iTrue; | 1655 | return iTrue; |
1656 | } | 1656 | } |
1657 | else if (contains_Rect(ui.rewindRect, mouse)) { | 1657 | else if (contains_Rect(ui.rewindRect, mouse)) { |
@@ -1667,7 +1667,7 @@ static iBool processAudioPlayerEvents_DocumentWidget_(iDocumentWidget *d, const | |||
1667 | setFlags_Player(plr, | 1667 | setFlags_Player(plr, |
1668 | adjustingVolume_PlayerFlag, | 1668 | adjustingVolume_PlayerFlag, |
1669 | !(flags_Player(plr) & adjustingVolume_PlayerFlag)); | 1669 | !(flags_Player(plr) & adjustingVolume_PlayerFlag)); |
1670 | animatePlayingAudio_DocumentWidget_(d); | 1670 | animatePlayers_DocumentWidget_(d); |
1671 | refresh_Widget(d); | 1671 | refresh_Widget(d); |
1672 | return iTrue; | 1672 | return iTrue; |
1673 | } | 1673 | } |
@@ -1923,7 +1923,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
1923 | processContextMenuEvent_Widget(d->menu, ev, d->hoverLink = NULL); | 1923 | processContextMenuEvent_Widget(d->menu, ev, d->hoverLink = NULL); |
1924 | } | 1924 | } |
1925 | } | 1925 | } |
1926 | if (processAudioPlayerEvents_DocumentWidget_(d, ev)) { | 1926 | if (processPlayerEvents_DocumentWidget_(d, ev)) { |
1927 | return iTrue; | 1927 | return iTrue; |
1928 | } | 1928 | } |
1929 | switch (processEvent_Click(&d->click, ev)) { | 1929 | switch (processEvent_Click(&d->click, ev)) { |
@@ -1935,7 +1935,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
1935 | iPlayer *plr = | 1935 | iPlayer *plr = |
1936 | audioPlayer_Media(media_GmDocument(d->doc), d->grabbedPlayer->audioId); | 1936 | audioPlayer_Media(media_GmDocument(d->doc), d->grabbedPlayer->audioId); |
1937 | iPlayerUI ui; | 1937 | iPlayerUI ui; |
1938 | init_PlayerUI(&ui, plr, audioPlayerRect_DocumentWidget_(d, d->grabbedPlayer)); | 1938 | init_PlayerUI(&ui, plr, playerRect_DocumentWidget_(d, d->grabbedPlayer)); |
1939 | float off = (float) delta_Click(&d->click).x / (float) width_Rect(ui.volumeSlider); | 1939 | float off = (float) delta_Click(&d->click).x / (float) width_Rect(ui.volumeSlider); |
1940 | setVolume_Player(plr, d->grabbedStartVolume + off); | 1940 | setVolume_Player(plr, d->grabbedStartVolume + off); |
1941 | refresh_Widget(w); | 1941 | refresh_Widget(w); |
@@ -2436,11 +2436,11 @@ static void drawSideElements_DocumentWidget_(const iDocumentWidget *d) { | |||
2436 | unsetClip_Paint(&p); | 2436 | unsetClip_Paint(&p); |
2437 | } | 2437 | } |
2438 | 2438 | ||
2439 | static void drawAudioPlayers_DocumentWidget_(const iDocumentWidget *d, iPaint *p) { | 2439 | static void drawPlayers_DocumentWidget_(const iDocumentWidget *d, iPaint *p) { |
2440 | iConstForEach(PtrArray, i, &d->visiblePlayers) { | 2440 | iConstForEach(PtrArray, i, &d->visiblePlayers) { |
2441 | const iGmRun * run = i.ptr; | 2441 | const iGmRun * run = i.ptr; |
2442 | const iPlayer *plr = audioPlayer_Media(media_GmDocument(d->doc), run->audioId); | 2442 | const iPlayer *plr = audioPlayer_Media(media_GmDocument(d->doc), run->audioId); |
2443 | const iRect rect = audioPlayerRect_DocumentWidget_(d, run); | 2443 | const iRect rect = playerRect_DocumentWidget_(d, run); |
2444 | iPlayerUI ui; | 2444 | iPlayerUI ui; |
2445 | init_PlayerUI(&ui, plr, rect); | 2445 | init_PlayerUI(&ui, plr, rect); |
2446 | draw_PlayerUI(&ui, p); | 2446 | draw_PlayerUI(&ui, p); |
@@ -2522,7 +2522,7 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) { | |||
2522 | render_GmDocument(d->doc, vis, drawMark_DrawContext_, &ctx); | 2522 | render_GmDocument(d->doc, vis, drawMark_DrawContext_, &ctx); |
2523 | SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_NONE); | 2523 | SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_NONE); |
2524 | } | 2524 | } |
2525 | drawAudioPlayers_DocumentWidget_(d, &ctx.paint); | 2525 | drawPlayers_DocumentWidget_(d, &ctx.paint); |
2526 | unsetClip_Paint(&ctx.paint); | 2526 | unsetClip_Paint(&ctx.paint); |
2527 | /* Fill the top and bottom, in case the document is short. */ | 2527 | /* Fill the top and bottom, in case the document is short. */ |
2528 | if (yTop > top_Rect(bounds)) { | 2528 | if (yTop > top_Rect(bounds)) { |