Subversion Repositories svn.mios32

Rev

Rev 2618 | Rev 2629 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2618 Rev 2628
Line 1... Line 1...
1
// $Id: seq_ui.c 2618 2018-12-20 00:18:18Z tk $
1
// $Id: seq_ui.c 2628 2018-12-30 21:14:09Z tk $
2
/*
2
/*
3
 * User Interface Routines
3
 * User Interface Routines
4
 *
4
 *
5
 * ==========================================================================
5
 * ==========================================================================
6
 *
6
 *
Line 527... Line 527...
527
// Mapped to physical buttons in SEQ_UI_Button_Handler()
527
// Mapped to physical buttons in SEQ_UI_Button_Handler()
528
// Will also be mapped to MIDI keys later (for MIDI remote function)
528
// Will also be mapped to MIDI keys later (for MIDI remote function)
529
/////////////////////////////////////////////////////////////////////////////
529
/////////////////////////////////////////////////////////////////////////////
530
static s32 SEQ_UI_Button_GP(s32 depressed, u32 gp)
530
static s32 SEQ_UI_Button_GP(s32 depressed, u32 gp)
531
{
531
{
-
 
532
  if( !depressed ) // selection button has been pressed while Bookm/Step/Track/Param/Trigger/Instr/Mute/Phrase button pressed: don't take over new sel view anymore
-
 
533
    seq_ui_button_state.TAKE_OVER_SEL_VIEW = 0;
-
 
534
532
  // in MENU page: overrule GP buttons as long as MENU button is pressed/active
535
  // in MENU page: overrule GP buttons as long as MENU button is pressed/active
533
  if( seq_ui_button_state.MENU_PRESSED || seq_hwcfg_blm.gp_always_select_menu_page ) {
536
  if( seq_ui_button_state.MENU_PRESSED || seq_hwcfg_blm.gp_always_select_menu_page ) {
534
    if( depressed ) return -1;
537
    if( depressed ) return -1;
535
    SEQ_UI_PageSet(SEQ_UI_PAGES_MenuShortcutPageGet(gp));
538
    SEQ_UI_PageSet(SEQ_UI_PAGES_MenuShortcutPageGet(gp));
536
  } else {
539
  } else {
Line 1304... Line 1307...
1304
}
1307
}
1305
1308
1306
1309
1307
static s32 SEQ_UI_Button_Bookmark(s32 depressed)
1310
static s32 SEQ_UI_Button_Bookmark(s32 depressed)
1308
{
1311
{
-
 
1312
  static seq_ui_sel_view_t prev_sel_view = SEQ_UI_SEL_VIEW_NONE;
-
 
1313
1309
  if( !depressed ) {
1314
  if( !depressed ) {
-
 
1315
    prev_sel_view = seq_ui_sel_view;
1310
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_BOOKMARKS;
1316
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_BOOKMARKS;
-
 
1317
    seq_ui_button_state.TAKE_OVER_SEL_VIEW = 1;
-
 
1318
  } else {
-
 
1319
    if( !seq_ui_button_state.TAKE_OVER_SEL_VIEW )
-
 
1320
      seq_ui_sel_view = prev_sel_view;
1311
  }
1321
  }
1312
1322
1313
  if( seq_hwcfg_button_beh.bookmark ) {
1323
  if( seq_hwcfg_button_beh.bookmark ) {
1314
    if( depressed ) return -1; // ignore when button depressed
1324
    if( depressed ) return -1; // ignore when button depressed
1315
    if( !seq_ui_button_state.BOOKMARK ) // due to page change: button going to be set, clear other toggle buttons
1325
    if( !seq_ui_button_state.BOOKMARK ) // due to page change: button going to be set, clear other toggle buttons
Line 1428... Line 1438...
1428
  return 0; // no error
1438
  return 0; // no error
1429
}
1439
}
1430
1440
1431
static s32 SEQ_UI_Button_Mute(s32 depressed)
1441
static s32 SEQ_UI_Button_Mute(s32 depressed)
1432
{
1442
{
-
 
1443
  static seq_ui_sel_view_t prev_sel_view = SEQ_UI_SEL_VIEW_NONE;
-
 
1444
1433
  if( !depressed ) {
1445
  if( !depressed ) {
-
 
1446
    prev_sel_view = seq_ui_sel_view;
1434
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_MUTE;
1447
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_MUTE;
-
 
1448
    seq_ui_button_state.TAKE_OVER_SEL_VIEW = 1;
-
 
1449
  } else {
-
 
1450
    if( !seq_ui_button_state.TAKE_OVER_SEL_VIEW )
-
 
1451
      seq_ui_sel_view = prev_sel_view;
1435
  }
1452
  }
1436
1453
1437
  seq_ui_button_state.MUTE_PRESSED = depressed ? 0 : 1;
1454
  seq_ui_button_state.MUTE_PRESSED = depressed ? 0 : 1;
1438
1455
1439
#if 0
1456
#if 0
Line 1505... Line 1522...
1505
  return 0; // no error
1522
  return 0; // no error
1506
}
1523
}
1507
1524
1508
static s32 SEQ_UI_Button_Phrase(s32 depressed)
1525
static s32 SEQ_UI_Button_Phrase(s32 depressed)
1509
{
1526
{
-
 
1527
  static seq_ui_sel_view_t prev_sel_view = SEQ_UI_SEL_VIEW_NONE;
-
 
1528
1510
  if( !depressed ) {
1529
  if( !depressed ) {
-
 
1530
    prev_sel_view = seq_ui_sel_view;
1511
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_PHRASE;
1531
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_PHRASE;
-
 
1532
    seq_ui_button_state.TAKE_OVER_SEL_VIEW = 1;
-
 
1533
  } else {
-
 
1534
    if( !seq_ui_button_state.TAKE_OVER_SEL_VIEW )
-
 
1535
      seq_ui_sel_view = prev_sel_view;
1512
  }
1536
  }
1513
1537
1514
  seq_ui_button_state.PHRASE_PRESSED = depressed ? 0 : 1;
1538
  seq_ui_button_state.PHRASE_PRESSED = depressed ? 0 : 1;
1515
1539
1516
  if( depressed ) return -1; // ignore when button depressed
1540
  if( depressed ) return -1; // ignore when button depressed
Line 1591... Line 1615...
1591
1615
1592
static s32 SEQ_UI_Button_StepView(s32 depressed)
1616
static s32 SEQ_UI_Button_StepView(s32 depressed)
1593
{
1617
{
1594
  //  static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1618
  //  static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1595
  // also used by seq_ui_stepsel
1619
  // also used by seq_ui_stepsel
-
 
1620
-
 
1621
  static seq_ui_sel_view_t prev_sel_view = SEQ_UI_SEL_VIEW_NONE;
1596
 
1622
1597
  if( !depressed ) {
1623
  if( !depressed ) {
-
 
1624
    prev_sel_view = seq_ui_sel_view;
1598
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_STEPS;
1625
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_STEPS;
-
 
1626
    seq_ui_button_state.TAKE_OVER_SEL_VIEW = 1;
-
 
1627
1599
    if( ui_page == SEQ_UI_PAGE_MUTE || SEQ_UI_PAGE_PATTERN || ui_page == SEQ_UI_PAGE_SONG ) SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT); // this selection only makes sense in EDIT page
1628
    if( ui_page == SEQ_UI_PAGE_MUTE || SEQ_UI_PAGE_PATTERN || ui_page == SEQ_UI_PAGE_SONG )
-
 
1629
      SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT); // this selection only makes sense in EDIT page
-
 
1630
  } else {
-
 
1631
    if( !seq_ui_button_state.TAKE_OVER_SEL_VIEW )
-
 
1632
      seq_ui_sel_view = prev_sel_view;
1600
  }
1633
  }
1601
1634
1602
  if( seq_hwcfg_button_beh.step_view ) {
1635
  if( seq_hwcfg_button_beh.step_view ) {
1603
    if( depressed ) return -1; // ignore when button depressed
1636
    if( depressed ) return -1; // ignore when button depressed
1604
    if( !seq_ui_button_state.STEP_VIEW ) // due to page change: button going to be set, clear other toggle buttons
1637
    if( !seq_ui_button_state.STEP_VIEW ) // due to page change: button going to be set, clear other toggle buttons
Line 1667... Line 1700...
1667
  return 0; // no error
1700
  return 0; // no error
1668
}
1701
}
1669
1702
1670
static s32 SEQ_UI_Button_TrackSel(s32 depressed)
1703
static s32 SEQ_UI_Button_TrackSel(s32 depressed)
1671
{
1704
{
-
 
1705
  static seq_ui_sel_view_t prev_sel_view = SEQ_UI_SEL_VIEW_NONE;
-
 
1706
1672
  if( !depressed ) {
1707
  if( !depressed ) {
-
 
1708
    prev_sel_view = seq_ui_sel_view;
1673
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_TRACKS;
1709
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_TRACKS;
-
 
1710
    seq_ui_button_state.TAKE_OVER_SEL_VIEW = 1;
-
 
1711
  } else {
-
 
1712
    if( !seq_ui_button_state.TAKE_OVER_SEL_VIEW )
-
 
1713
      seq_ui_sel_view = prev_sel_view;
1674
  }
1714
  }
1675
1715
1676
  if( seq_hwcfg_button_beh.track_sel ) {
1716
  if( seq_hwcfg_button_beh.track_sel ) {
1677
    if( depressed ) return -1; // ignore when button depressed
1717
    if( depressed ) return -1; // ignore when button depressed
1678
    if( !seq_ui_button_state.TRACK_SEL ) // due to page change: button going to be set, clear other toggle buttons
1718
    if( !seq_ui_button_state.TRACK_SEL ) // due to page change: button going to be set, clear other toggle buttons
Line 1772... Line 1812...
1772
  }
1812
  }
1773
1813
1774
  u8 visible_track = SEQ_UI_VisibleTrackGet();
1814
  u8 visible_track = SEQ_UI_VisibleTrackGet();
1775
1815
1776
  if( selbuttons_available ) {
1816
  if( selbuttons_available ) {
-
 
1817
    if( !depressed ) // selection button has been pressed while Bookm/Step/Track/Param/Trigger/Instr/Mute/Phrase button pressed: don't take over new sel view anymore
-
 
1818
      seq_ui_button_state.TAKE_OVER_SEL_VIEW = 0;
-
 
1819
1777
    // for selection buttons of Antilog PCB
1820
    // for selection buttons of Antilog PCB
1778
      switch( seq_ui_sel_view ) {
1821
    switch( seq_ui_sel_view ) {
1779
      case SEQ_UI_SEL_VIEW_BOOKMARKS:
1822
      case SEQ_UI_SEL_VIEW_BOOKMARKS:
1780
    SEQ_UI_BOOKMARKS_Button_Handler((seq_ui_button_t)sel_button, depressed);
1823
    SEQ_UI_BOOKMARKS_Button_Handler((seq_ui_button_t)sel_button, depressed);
1781
    break;
1824
    break;
Line 1829... Line 1872...
1829
      } break;
1872
      } break;
1830
      case SEQ_UI_SEL_VIEW_PHRASE: {
1873
      case SEQ_UI_SEL_VIEW_PHRASE: {
1831
    if( depressed )
1874
    if( depressed )
1832
      return 0; // no error
1875
      return 0; // no error
1833
1876
1834
    if( seq_ui_button_state.PHRASE_PRESSED || (ui_page == SEQ_UI_PAGE_SONG && ui_selected_item >= 1) ) { // TODO: has to be aligned with #define in seq_ui_song.c
1877
    //if( seq_ui_button_state.PHRASE_PRESSED || (ui_page == SEQ_UI_PAGE_SONG && ui_selected_item >= 1) ) { // TODO: has to be aligned with #define in seq_ui_song.c
1835
      SEQ_UI_SONG_Button_Handler((seq_ui_button_t)sel_button, depressed);
1878
    //  SEQ_UI_SONG_Button_Handler((seq_ui_button_t)sel_button, depressed);
1836
    } else {
1879
    //} else {
1837
      ui_selected_phrase = sel_button;
1880
      ui_selected_phrase = sel_button;
1838
      ui_song_edit_pos = ui_selected_phrase << 3;
1881
      ui_song_edit_pos = ui_selected_phrase << 3;
1839
1882
1840
      // set song position and fetch patterns
1883
      // set song position and fetch patterns
1841
      SEQ_SONG_PosSet(ui_song_edit_pos);
1884
      SEQ_SONG_PosSet(ui_song_edit_pos);
1842
      SEQ_SONG_FetchPos(0, 0);
1885
      SEQ_SONG_FetchPos(0, 0);
1843
      ui_song_edit_pos = SEQ_SONG_PosGet();
1886
      ui_song_edit_pos = SEQ_SONG_PosGet();
1844
    }
1887
    //}
1845
      } break;
1888
      } break;
1846
      }    
1889
      }    
1847
  } else {
1890
  } else {
1848
    // common behaviour
1891
    // common behaviour
1849
    if( button_state == (~(1 << sel_button) & 0xffff) ) {
1892
    if( button_state == (~(1 << sel_button) & 0xffff) ) {
Line 1864... Line 1907...
1864
1907
1865
static s32 SEQ_UI_Button_ParLayerSel(s32 depressed)
1908
static s32 SEQ_UI_Button_ParLayerSel(s32 depressed)
1866
{
1909
{
1867
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1910
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1868
  // also used by seq_ui_parsel.c
1911
  // also used by seq_ui_parsel.c
-
 
1912
-
 
1913
  static seq_ui_sel_view_t prev_sel_view = SEQ_UI_SEL_VIEW_NONE;
1869
1914
1870
  if( !depressed ) {
1915
  if( !depressed ) {
-
 
1916
    prev_sel_view = seq_ui_sel_view;
1871
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_PAR;
1917
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_PAR;
-
 
1918
    seq_ui_button_state.TAKE_OVER_SEL_VIEW = 1;
-
 
1919
1872
    if( ui_page == SEQ_UI_PAGE_MUTE || ui_page == SEQ_UI_PAGE_PATTERN || ui_page == SEQ_UI_PAGE_SONG ) SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT); // this selection only makes sense in EDIT page
1920
    if( ui_page == SEQ_UI_PAGE_MUTE || ui_page == SEQ_UI_PAGE_PATTERN || ui_page == SEQ_UI_PAGE_SONG )
-
 
1921
      SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT); // this selection only makes sense in EDIT page
-
 
1922
  } else {
-
 
1923
    if( !seq_ui_button_state.TAKE_OVER_SEL_VIEW )
-
 
1924
      seq_ui_sel_view = prev_sel_view;
1873
  }
1925
  }
1874
1926
1875
  if( seq_hwcfg_button_beh.par_layer ) {
1927
  if( seq_hwcfg_button_beh.par_layer ) {
1876
    if( depressed ) return -1; // ignore when button depressed
1928
    if( depressed ) return -1; // ignore when button depressed
1877
    if( !seq_ui_button_state.PAR_LAYER_SEL ) // due to page change: button going to be set, clear other toggle buttons
1929
    if( !seq_ui_button_state.PAR_LAYER_SEL ) // due to page change: button going to be set, clear other toggle buttons
Line 1982... Line 2034...
1982
2034
1983
static s32 SEQ_UI_Button_TrgLayerSel(s32 depressed)
2035
static s32 SEQ_UI_Button_TrgLayerSel(s32 depressed)
1984
{
2036
{
1985
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
2037
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
1986
  // also used by seq_ui_trgsel.c
2038
  // also used by seq_ui_trgsel.c
-
 
2039
-
 
2040
  static seq_ui_sel_view_t prev_sel_view = SEQ_UI_SEL_VIEW_NONE;
1987
2041
1988
  if( !depressed ) {
2042
  if( !depressed ) {
-
 
2043
    prev_sel_view = seq_ui_sel_view;
1989
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_TRG;
2044
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_TRG;
-
 
2045
    seq_ui_button_state.TAKE_OVER_SEL_VIEW = 1;
-
 
2046
1990
    if( ui_page == SEQ_UI_PAGE_MUTE || ui_page == SEQ_UI_PAGE_PATTERN || ui_page == SEQ_UI_PAGE_SONG ) SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT); // this selection only makes sense in EDIT page
2047
    if( ui_page == SEQ_UI_PAGE_MUTE || ui_page == SEQ_UI_PAGE_PATTERN || ui_page == SEQ_UI_PAGE_SONG )
-
 
2048
      SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT); // this selection only makes sense in EDIT page
-
 
2049
  } else {
-
 
2050
    if( !seq_ui_button_state.TAKE_OVER_SEL_VIEW )
-
 
2051
      seq_ui_sel_view = prev_sel_view;
1991
  }
2052
  }
1992
2053
1993
  if( seq_hwcfg_button_beh.trg_layer ) {
2054
  if( seq_hwcfg_button_beh.trg_layer ) {
1994
    if( depressed ) return -1; // ignore when button depressed
2055
    if( depressed ) return -1; // ignore when button depressed
1995
    if( !seq_ui_button_state.TRG_LAYER_SEL ) // due to page change: button going to be set, clear other toggle buttons
2056
    if( !seq_ui_button_state.TRG_LAYER_SEL ) // due to page change: button going to be set, clear other toggle buttons
Line 2089... Line 2150...
2089
2150
2090
static s32 SEQ_UI_Button_InsSel(s32 depressed)
2151
static s32 SEQ_UI_Button_InsSel(s32 depressed)
2091
{
2152
{
2092
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
2153
  // static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
2093
  // also used by seq_ui_insel.c
2154
  // also used by seq_ui_insel.c
-
 
2155
-
 
2156
  static seq_ui_sel_view_t prev_sel_view = SEQ_UI_SEL_VIEW_NONE;
2094
2157
2095
  if( !depressed ) {
2158
  if( !depressed ) {
-
 
2159
    prev_sel_view = seq_ui_sel_view;
2096
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_INS;
2160
    seq_ui_sel_view = SEQ_UI_SEL_VIEW_INS;
-
 
2161
    seq_ui_button_state.TAKE_OVER_SEL_VIEW = 1;
-
 
2162
2097
    if( ui_page == SEQ_UI_PAGE_MUTE || ui_page == SEQ_UI_PAGE_PATTERN || ui_page == SEQ_UI_PAGE_SONG ) SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT); // this selection only makes sense in EDIT page
2163
    if( ui_page == SEQ_UI_PAGE_MUTE || ui_page == SEQ_UI_PAGE_PATTERN || ui_page == SEQ_UI_PAGE_SONG )
-
 
2164
      SEQ_UI_PageSet(SEQ_UI_PAGE_EDIT); // this selection only makes sense in EDIT page
-
 
2165
  } else {
-
 
2166
    if( !seq_ui_button_state.TAKE_OVER_SEL_VIEW )
-
 
2167
      seq_ui_sel_view = prev_sel_view;
2098
  }
2168
  }
2099
2169
2100
  if( seq_hwcfg_button_beh.ins_sel ) {
2170
  if( seq_hwcfg_button_beh.ins_sel ) {
2101
    if( depressed ) return -1; // ignore when button depressed
2171
    if( depressed ) return -1; // ignore when button depressed
2102
    if( !seq_ui_button_state.INS_SEL ) // due to page change: button going to be set, clear other toggle buttons
2172
    if( !seq_ui_button_state.INS_SEL ) // due to page change: button going to be set, clear other toggle buttons