
タイニー番組ナビゲータ本体
| Revision | f83c61de4ec4dac07f7ba38cd9a2bb757f94fbb7 (tree) |
|---|---|
| Time | 2023-04-07 22:55:56 |
| Author | Masahiko Kimura <mkimura@u01....> |
| Commiter | Masahiko Kimura |
Ver.1.13.7 (2023/4/7)
1. [新聞形式]ページャーのツールチップでページ内の放送局を一覧表示する
2. [新聞形式]ヘッダーの右クリックメニューで放送局別表示と放送局表示(1週おき)を切り替えられるようにする
3. [新聞形式]同じく放送局別表示(1週おき)で曜日を前後に切り替えられるようにする
4. [全般]テキストボックスの右クリックメニューに「Googleで検索」「Syobocalで検索」を追加する
| @@ -2544,7 +2544,78 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
| 2544 | 2544 | } |
| 2545 | 2545 | |
| 2546 | 2546 | /* |
| 2547 | - * 放送局別で前のページに移動する | |
| 2547 | + * 放送局別1週間おき表示で前の日に移動する | |
| 2548 | + */ | |
| 2549 | + public void moveToPrevDateIndex(){ | |
| 2550 | + if (!isPrevDateIndexEnabled()) | |
| 2551 | + return; | |
| 2552 | + | |
| 2553 | + PassedProgram passed = tvprograms.getPassed(); | |
| 2554 | + | |
| 2555 | + String date = passed.getPrevDate(startDate, 1); | |
| 2556 | + if (date == null) | |
| 2557 | + return; | |
| 2558 | + | |
| 2559 | + startDate = date; | |
| 2560 | + | |
| 2561 | + // 表を描画し直す | |
| 2562 | + redrawByCurrentSelection(); | |
| 2563 | + } | |
| 2564 | + | |
| 2565 | + /* | |
| 2566 | + * 放送局別1週間おき表示で前の日に移動可能かを返す | |
| 2567 | + */ | |
| 2568 | + public boolean isPrevDateIndexEnabled(){ | |
| 2569 | + PassedProgram passed = tvprograms.getPassed(); | |
| 2570 | + | |
| 2571 | + String date = passed.getPrevDate(startDate, 1); | |
| 2572 | + | |
| 2573 | + return date != null; | |
| 2574 | + } | |
| 2575 | + | |
| 2576 | + /* | |
| 2577 | + * 放送局別1週間おき表示で次の日に移動する | |
| 2578 | + */ | |
| 2579 | + public void moveToNextDateIndex(){ | |
| 2580 | + if (!isNextDateIndexEnabled()) | |
| 2581 | + return; | |
| 2582 | + | |
| 2583 | + PassedProgram passed = tvprograms.getPassed(); | |
| 2584 | + | |
| 2585 | + String date = passed.getNextDate(startDate, 1); | |
| 2586 | + if (date == null) | |
| 2587 | + date = CommonUtils.getDate529(0, true); | |
| 2588 | + | |
| 2589 | + startDate = date; | |
| 2590 | + | |
| 2591 | + // 表を描画し直す | |
| 2592 | + redrawByCurrentSelection(); | |
| 2593 | + } | |
| 2594 | + | |
| 2595 | + /* | |
| 2596 | + * 放送局別1週間おき表示で次の日に移動可能かを返す | |
| 2597 | + */ | |
| 2598 | + public boolean isNextDateIndexEnabled(){ | |
| 2599 | + String today = CommonUtils.getDate529(0, true); | |
| 2600 | + if (this.byCenterModeDayInterval == 1){ | |
| 2601 | + return (startDate.compareTo(today) < 0); | |
| 2602 | + } | |
| 2603 | + | |
| 2604 | + GregorianCalendar ct = CommonUtils.getCalendar(today); | |
| 2605 | + ct.add(GregorianCalendar.DAY_OF_MONTH, 7); | |
| 2606 | + String dateMax = CommonUtils.getDate(ct); | |
| 2607 | + | |
| 2608 | + ct = CommonUtils.getCalendar(startDate); | |
| 2609 | + if (ct == null) | |
| 2610 | + return false; | |
| 2611 | + ct.add(GregorianCalendar.DAY_OF_MONTH, (env.getDatePerPassedPage()-1)*this.byCenterModeDayInterval+1); | |
| 2612 | + String date = CommonUtils.getDate(ct); | |
| 2613 | + | |
| 2614 | + return (date.compareTo(dateMax) <= 0); | |
| 2615 | + } | |
| 2616 | + | |
| 2617 | + /* | |
| 2618 | + * 放送局別1週間おき表示で前の日に移動する | |
| 2548 | 2619 | */ |
| 2549 | 2620 | public void moveToPrevDatePage(){ |
| 2550 | 2621 | PassedProgram passed = tvprograms.getPassed(); |
| @@ -3259,7 +3330,7 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
| 3259 | 3330 | // ポインタの位置 |
| 3260 | 3331 | Point p = e.getPoint(); |
| 3261 | 3332 | |
| 3262 | - JMenuItem menuItem = new JMenuItem(String.format("放送局別表示【%s】", center)); | |
| 3333 | + JMenuItem menuItem = new JMenuItem(String.format("放送局別表示へ切り替え【%s】", center)); | |
| 3263 | 3334 | Font f = menuItem.getFont(); |
| 3264 | 3335 | menuItem.setFont(f.deriveFont(f.getStyle()|Font.BOLD)); |
| 3265 | 3336 | menuItem.addActionListener(new ActionListener() { |
| @@ -3278,7 +3349,7 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
| 3278 | 3349 | }); |
| 3279 | 3350 | pop.add(menuItem); |
| 3280 | 3351 | |
| 3281 | - menuItem = new JMenuItem(String.format("放送局別1週おき表示【%s】", center)); | |
| 3352 | + menuItem = new JMenuItem(String.format("放送局別表示(1週おき)へ切り替え【%s】", center)); | |
| 3282 | 3353 | menuItem.addActionListener(new ActionListener() { |
| 3283 | 3354 | public void actionPerformed(ActionEvent e) { |
| 3284 | 3355 | byCenterModeDayInterval = 7; |
| @@ -3340,6 +3411,101 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
| 3340 | 3411 | redrawByDateWithCenter(center, date); |
| 3341 | 3412 | } |
| 3342 | 3413 | } |
| 3414 | + else if (e.getButton() == MouseEvent.BUTTON3){ | |
| 3415 | + JPopupMenu pop = new JPopupMenu(); | |
| 3416 | + // ポインタの位置 | |
| 3417 | + Point p = e.getPoint(); | |
| 3418 | + String date = ((JTXTLabel)e.getSource()).getValue(); | |
| 3419 | + | |
| 3420 | + JMenuItem menuItem = new JMenuItem(String.format("日付表示へ切り替え【%s】", date) ); | |
| 3421 | + Font f = menuItem.getFont(); | |
| 3422 | + menuItem.setFont(f.deriveFont(f.getStyle()|Font.BOLD)); | |
| 3423 | + menuItem.addActionListener(new ActionListener() { | |
| 3424 | + public void actionPerformed(ActionEvent e) { | |
| 3425 | + JTreeLabel.Nodes node = jLabel_tree.getNode(); | |
| 3426 | + String value = jLabel_tree.getValue(); | |
| 3427 | + if (node == null || value == null) | |
| 3428 | + return; | |
| 3429 | + | |
| 3430 | + String center = value; | |
| 3431 | + | |
| 3432 | + StdAppendMessage(MSGID+"日付表示に切り替え:"+date); | |
| 3433 | + | |
| 3434 | + String today = CommonUtils.getDate529(0, true); | |
| 3435 | + | |
| 3436 | + // 過去日の場合、過去ログの日付を選択する | |
| 3437 | + if (date.compareTo(today) < 0){ | |
| 3438 | + // 指定した日付のノードがツリーになければ作成する | |
| 3439 | + addPassedNodeIfNotExist(date); | |
| 3440 | + } | |
| 3441 | + | |
| 3442 | + redrawByDateWithCenter(center, date); | |
| 3443 | + } | |
| 3444 | + }); | |
| 3445 | + pop.add(menuItem); | |
| 3446 | + | |
| 3447 | + if (byCenterModeDayInterval == 7){ | |
| 3448 | + menuItem = new JMenuItem(String.format("放送局別表示へ切り替え【%s】", date)); | |
| 3449 | + menuItem.addActionListener(new ActionListener() { | |
| 3450 | + public void actionPerformed(ActionEvent e) { | |
| 3451 | + byCenterModeDayInterval = 1; | |
| 3452 | + | |
| 3453 | + GregorianCalendar c = CommonUtils.getCalendar(date); | |
| 3454 | + if (c != null) | |
| 3455 | + startDate = date; | |
| 3456 | + else | |
| 3457 | + startDate = CommonUtils.getDate529(0, true); | |
| 3458 | + | |
| 3459 | + reselectTree(); | |
| 3460 | + } | |
| 3461 | + }); | |
| 3462 | + pop.add(menuItem); | |
| 3463 | + | |
| 3464 | + pop.addSeparator(); | |
| 3465 | + GregorianCalendar c = CommonUtils.getCalendar(date); | |
| 3466 | + c.add(Calendar.DATE, -1); | |
| 3467 | + | |
| 3468 | + menuItem = new JMenuItem(String.format("前の曜日へ【%s】", CommonUtils.getWeekDayString(c.get(Calendar.DAY_OF_WEEK)))); | |
| 3469 | + menuItem.setEnabled(isPrevDateIndexEnabled()); | |
| 3470 | + menuItem.addActionListener(new ActionListener() { | |
| 3471 | + public void actionPerformed(ActionEvent e) { | |
| 3472 | + moveToPrevDateIndex(); | |
| 3473 | + } | |
| 3474 | + }); | |
| 3475 | + pop.add(menuItem); | |
| 3476 | + | |
| 3477 | + c = CommonUtils.getCalendar(date); | |
| 3478 | + c.add(Calendar.DATE, 1); | |
| 3479 | + | |
| 3480 | + menuItem = new JMenuItem(String.format("次の曜日へ【%s】", CommonUtils.getWeekDayString(c.get(Calendar.DAY_OF_WEEK)))); | |
| 3481 | + menuItem.setEnabled(isNextDateIndexEnabled()); | |
| 3482 | + menuItem.addActionListener(new ActionListener() { | |
| 3483 | + public void actionPerformed(ActionEvent e) { | |
| 3484 | + moveToNextDateIndex(); | |
| 3485 | + } | |
| 3486 | + }); | |
| 3487 | + pop.add(menuItem); | |
| 3488 | + } | |
| 3489 | + else{ | |
| 3490 | + menuItem = new JMenuItem(String.format("放送局別表示(1週おき)へ切り替え【%s】", date)); | |
| 3491 | + menuItem.addActionListener(new ActionListener() { | |
| 3492 | + public void actionPerformed(ActionEvent e) { | |
| 3493 | + byCenterModeDayInterval = 7; | |
| 3494 | + | |
| 3495 | + GregorianCalendar c = CommonUtils.getCalendar(date); | |
| 3496 | + if (c != null) | |
| 3497 | + startDate = date; | |
| 3498 | + else | |
| 3499 | + startDate = CommonUtils.getDate529(0, true); | |
| 3500 | + | |
| 3501 | + reselectTree(); | |
| 3502 | + } | |
| 3503 | + }); | |
| 3504 | + pop.add(menuItem); | |
| 3505 | + } | |
| 3506 | + | |
| 3507 | + pop.show((Component)e.getSource(), p.x, p.y); | |
| 3508 | + } | |
| 3343 | 3509 | } |
| 3344 | 3510 | }; |
| 3345 | 3511 |
| @@ -18,6 +18,7 @@ import java.net.URISyntaxException; | ||
| 18 | 18 | import java.util.ArrayList; |
| 19 | 19 | import java.util.Calendar; |
| 20 | 20 | import java.util.GregorianCalendar; |
| 21 | +import java.util.StringJoiner; | |
| 21 | 22 | import java.util.regex.Matcher; |
| 22 | 23 | import java.util.regex.Pattern; |
| 23 | 24 |
| @@ -914,6 +915,7 @@ public abstract class AbsToolBar extends JToolBar implements HDDRecorderSelectab | ||
| 914 | 915 | // jComboBox_pager.setToolTipText(jComboBox_pager.getSelectedItem().toString()); |
| 915 | 916 | |
| 916 | 917 | updatePagerButtons(); |
| 918 | + updatePagerTooltipText(); | |
| 917 | 919 | |
| 918 | 920 | // イベント再開 |
| 919 | 921 | jComboBox_pager.addItemListener(il_pagerSelected); |
| @@ -942,9 +944,32 @@ public abstract class AbsToolBar extends JToolBar implements HDDRecorderSelectab | ||
| 942 | 944 | jComboBox_pager.setSelectedIndex(idx); |
| 943 | 945 | |
| 944 | 946 | updatePagerButtons(); |
| 947 | + updatePagerTooltipText(); | |
| 945 | 948 | } |
| 946 | 949 | } |
| 947 | 950 | |
| 951 | + public void updatePagerTooltipText(){ | |
| 952 | + StringJoiner sb = new StringJoiner("<BR>"); | |
| 953 | + int pno = getSelectedPagerIndex(); | |
| 954 | + if (pno >= 0 && pno < getPagerCount()){ | |
| 955 | + String text = (String)jComboBox_pager.getItemAt(pno); | |
| 956 | + Matcher ma = Pattern.compile("([1-9]/[1-9]) - (.*)").matcher(text); | |
| 957 | + if (ma.find()){ | |
| 958 | + String [] centers = ma.group(2).split("、"); | |
| 959 | + int no = 1; | |
| 960 | + for (String center : centers){ | |
| 961 | + sb.add(String.valueOf(no++) + ":" + center); | |
| 962 | + } | |
| 963 | + | |
| 964 | + String tooltip = "<HTML><B>" + TIPS_PAGER + "(" + ma.group(1) + ")</B><BR>" + sb.toString() + "</HTML>"; | |
| 965 | + jComboBox_pager.setToolTipText(tooltip); | |
| 966 | + return; | |
| 967 | + } | |
| 968 | + } | |
| 969 | + | |
| 970 | + jComboBox_pager.setToolTipText(TIPS_PAGER); | |
| 971 | + } | |
| 972 | + | |
| 948 | 973 | /* |
| 949 | 974 | * 前の放送局ページに移動する |
| 950 | 975 | */ |
| @@ -1452,6 +1477,7 @@ public abstract class AbsToolBar extends JToolBar implements HDDRecorderSelectab | ||
| 1452 | 1477 | if (e.getStateChange() == ItemEvent.SELECTED) { |
| 1453 | 1478 | if (debug) System.out.println(DBGID+"PAGER SELECTED"); |
| 1454 | 1479 | redrawByPager(); |
| 1480 | + updatePagerTooltipText(); | |
| 1455 | 1481 | // jComboBox_pager.setToolTipText(jComboBox_pager.getSelectedItem().toString()); |
| 1456 | 1482 | } |
| 1457 | 1483 | } |
| @@ -113,6 +113,19 @@ public class CommonUtils { | ||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | + * 曜日のINDEXから名称を取得する | |
| 117 | + * | |
| 118 | + * @param n 曜日INDEX | |
| 119 | + * @return 曜日名称 | |
| 120 | + */ | |
| 121 | + public static String getWeekDayString(int n){ | |
| 122 | + if (n < 1 || n > 7) | |
| 123 | + return ""; | |
| 124 | + | |
| 125 | + return WDTPTN[n-1]; | |
| 126 | + } | |
| 127 | + | |
| 128 | + /** | |
| 116 | 129 | * 月日に年を補完 |
| 117 | 130 | */ |
| 118 | 131 | public static String getDateByMD(int m, int d, int wday, boolean addwstr) { |
| @@ -1,8 +1,16 @@ | ||
| 1 | 1 | package tainavi; |
| 2 | 2 | |
| 3 | +import java.awt.Desktop; | |
| 4 | +import java.awt.event.ActionEvent; | |
| 5 | +import java.awt.event.ActionListener; | |
| 3 | 6 | import java.awt.event.KeyEvent; |
| 4 | 7 | import java.awt.event.MouseAdapter; |
| 5 | 8 | import java.awt.event.MouseEvent; |
| 9 | +import java.io.IOException; | |
| 10 | +import java.io.UnsupportedEncodingException; | |
| 11 | +import java.net.URI; | |
| 12 | +import java.net.URISyntaxException; | |
| 13 | +import java.net.URLEncoder; | |
| 6 | 14 | |
| 7 | 15 | import javax.swing.Action; |
| 8 | 16 | import javax.swing.ActionMap; |
| @@ -11,6 +19,7 @@ import javax.swing.JMenuItem; | ||
| 11 | 19 | import javax.swing.JPopupMenu; |
| 12 | 20 | import javax.swing.KeyStroke; |
| 13 | 21 | import javax.swing.text.DefaultEditorKit; |
| 22 | +import javax.swing.text.JTextComponent; | |
| 14 | 23 | |
| 15 | 24 | public class TextEditPopupMenu extends MouseAdapter { |
| 16 | 25 |
| @@ -18,24 +27,24 @@ public class TextEditPopupMenu extends MouseAdapter { | ||
| 18 | 27 | public void mouseReleased(MouseEvent e) { |
| 19 | 28 | mousePopup(e); |
| 20 | 29 | } |
| 21 | - | |
| 30 | + | |
| 22 | 31 | @Override |
| 23 | 32 | public void mousePressed(MouseEvent e) { |
| 24 | 33 | mousePopup(e); |
| 25 | 34 | } |
| 26 | - | |
| 35 | + | |
| 27 | 36 | @Override |
| 28 | 37 | public void mouseExited(MouseEvent e) { |
| 29 | 38 | } |
| 30 | - | |
| 39 | + | |
| 31 | 40 | @Override |
| 32 | 41 | public void mouseEntered(MouseEvent e) { |
| 33 | 42 | } |
| 34 | - | |
| 43 | + | |
| 35 | 44 | @Override |
| 36 | 45 | public void mouseClicked(MouseEvent e) { |
| 37 | 46 | } |
| 38 | - | |
| 47 | + | |
| 39 | 48 | // |
| 40 | 49 | private void mousePopup(MouseEvent e) { |
| 41 | 50 | if (e.isPopupTrigger()) { |
| @@ -44,30 +53,87 @@ public class TextEditPopupMenu extends MouseAdapter { | ||
| 44 | 53 | e.consume(); |
| 45 | 54 | } |
| 46 | 55 | } |
| 47 | - | |
| 56 | + | |
| 48 | 57 | private void showPopup(JComponent c, int x, int y) { |
| 49 | - | |
| 58 | + JTextComponent tc = (JTextComponent)c; | |
| 59 | + boolean bc = tc.getSelectedText() != null; | |
| 60 | + boolean bp = tc.isEditable(); | |
| 61 | + | |
| 50 | 62 | JPopupMenu pmenu = new JPopupMenu(); |
| 51 | - | |
| 63 | + | |
| 52 | 64 | ActionMap am = c.getActionMap(); |
| 53 | - | |
| 65 | + | |
| 54 | 66 | Action cut = am.get(DefaultEditorKit.cutAction); |
| 55 | - addMenu(pmenu, "切り取り(X)", cut, 'X', KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK)); | |
| 67 | + addMenu(pmenu, "切り取り(X)", cut, 'X', KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK), bc && bp); | |
| 56 | 68 | |
| 57 | 69 | Action copy = am.get(DefaultEditorKit.copyAction); |
| 58 | - addMenu(pmenu, "コピー(C)", copy, 'C', KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK)); | |
| 70 | + addMenu(pmenu, "コピー(C)", copy, 'C', KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK), bc); | |
| 59 | 71 | |
| 60 | 72 | Action paste = am.get(DefaultEditorKit.pasteAction); |
| 61 | - addMenu(pmenu, "貼り付け(V)", paste, 'V', KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK)); | |
| 73 | + addMenu(pmenu, "貼り付け(V)", paste, 'V', KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK), bp); | |
| 62 | 74 | |
| 63 | 75 | Action all = am.get(DefaultEditorKit.selectAllAction); |
| 64 | - addMenu(pmenu, "すべて選択(A)", all, 'A', KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK)); | |
| 65 | - | |
| 76 | + addMenu(pmenu, "すべて選択(A)", all, 'A', KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK), true); | |
| 77 | + | |
| 78 | + pmenu.addSeparator(); | |
| 79 | + | |
| 80 | + JMenuItem mi = new JMenuItemWithShortcut("Googleで検索(S)"); | |
| 81 | + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_DOWN_MASK)); | |
| 82 | + mi.addActionListener(new ActionListener() { | |
| 83 | + public void actionPerformed(ActionEvent e) { | |
| 84 | + String value = tc.getSelectedText(); | |
| 85 | + ; | |
| 86 | + if (value != null && !value.isEmpty()){ | |
| 87 | + if (value != null && !value.isEmpty()){ | |
| 88 | + try { | |
| 89 | + showURL("http://www.google.co.jp/search?q=" + URLEncoder.encode(value, "UTF-8")); | |
| 90 | + } catch (UnsupportedEncodingException e1) { | |
| 91 | + // TODO 自動生成された catch ブロック | |
| 92 | + e1.printStackTrace(); | |
| 93 | + } | |
| 94 | + } | |
| 95 | + } | |
| 96 | + } | |
| 97 | + }); | |
| 98 | + mi.setEnabled(bc); | |
| 99 | + pmenu.add(mi); | |
| 100 | + | |
| 101 | + JMenuItem mi2 = new JMenuItemWithShortcut("Syobocalで検索(B)"); | |
| 102 | + mi2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_DOWN_MASK)); | |
| 103 | + mi2.addActionListener(new ActionListener() { | |
| 104 | + public void actionPerformed(ActionEvent e) { | |
| 105 | + String value = tc.getSelectedText(); | |
| 106 | + if (value != null && !value.isEmpty()){ | |
| 107 | + try { | |
| 108 | + showURL("http://cal.syoboi.jp/find?kw=" + URLEncoder.encode(value, "UTF-8") + "&exec=%E6%A4%9C%E7%B4%A2"); | |
| 109 | + } catch (UnsupportedEncodingException e1) { | |
| 110 | + // TODO 自動生成された catch ブロック | |
| 111 | + e1.printStackTrace(); | |
| 112 | + } | |
| 113 | + } | |
| 114 | + } | |
| 115 | + }); | |
| 116 | + mi2.setEnabled(bc); | |
| 117 | + pmenu.add(mi2); | |
| 118 | + | |
| 66 | 119 | c.requestFocusInWindow(); |
| 67 | 120 | pmenu.show(c, x, y); |
| 68 | 121 | } |
| 69 | - | |
| 70 | - private void addMenu(JPopupMenu pmenu, String text, Action action, int mnemonic, KeyStroke ks) { | |
| 122 | + | |
| 123 | + private void showURL(String url){ | |
| 124 | + Desktop desktop = Desktop.getDesktop(); | |
| 125 | + try { | |
| 126 | + desktop.browse(new URI(url)); | |
| 127 | + } catch (IOException e1) { | |
| 128 | + // TODO 自動生成された catch ブロック | |
| 129 | + e1.printStackTrace(); | |
| 130 | + } catch (URISyntaxException e1) { | |
| 131 | + // TODO 自動生成された catch ブロック | |
| 132 | + e1.printStackTrace(); | |
| 133 | + } | |
| 134 | + } | |
| 135 | + | |
| 136 | + private void addMenu(JPopupMenu pmenu, String text, Action action, int mnemonic, KeyStroke ks, boolean enable) { | |
| 71 | 137 | if (action != null) { |
| 72 | 138 | JMenuItem mi = pmenu.add(action); |
| 73 | 139 | if (text != null) { |
| @@ -79,6 +145,8 @@ public class TextEditPopupMenu extends MouseAdapter { | ||
| 79 | 145 | if (ks != null) { |
| 80 | 146 | mi.setAccelerator(ks); |
| 81 | 147 | } |
| 148 | + | |
| 149 | + mi.setEnabled(enable); | |
| 82 | 150 | } |
| 83 | 151 | } |
| 84 | 152 | } |
| @@ -53,7 +53,7 @@ public class VWFolderDialog extends JDialog { | ||
| 53 | 53 | |
| 54 | 54 | private JPanel jPanel = null; |
| 55 | 55 | private JLabel jLabel_folder = null; |
| 56 | - private JTextField jTextField_folder = null; | |
| 56 | + private JTextFieldWithPopup jTextField_folder = null; | |
| 57 | 57 | private JButton jButton_cancel = null; |
| 58 | 58 | private JButton jButton_create = null; |
| 59 | 59 |
| @@ -272,7 +272,7 @@ public class VWFolderDialog extends JDialog { | ||
| 272 | 272 | // |
| 273 | 273 | private JTextField getJTextField_folder() { |
| 274 | 274 | if (jTextField_folder == null) { |
| 275 | - jTextField_folder = new JTextField(); | |
| 275 | + jTextField_folder = new JTextFieldWithPopup(); | |
| 276 | 276 | jTextField_folder.addActionListener(al_create); |
| 277 | 277 | jTextField_folder.addKeyListener(kl_cancel); |
| 278 | 278 | jTextField_folder.getDocument().addDocumentListener(dl_folderChanged); |
| @@ -5,7 +5,7 @@ import java.util.regex.Pattern; | ||
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | public class VersionInfo { |
| 8 | - private static final String Version = "タイニー番組ナビゲータ for DBR-T2007 3.22.18β+1.13.6"; | |
| 8 | + private static final String Version = "タイニー番組ナビゲータ for DBR-T2007 3.22.18β+1.13.7"; | |
| 9 | 9 | |
| 10 | 10 | private static final String OSname = System.getProperty("os.name"); |
| 11 | 11 | private static final String OSvers = System.getProperty("os.version"); |
| @@ -6078,6 +6078,9 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
| 6078 | 6078 | final String BUTTON_ACTION_NEXT_CENTERPAGE = "nextcenterpage"; |
| 6079 | 6079 | final String BUTTON_ACTION_PREV_CENTERPAGE = "prevcenterpage"; |
| 6080 | 6080 | |
| 6081 | + final String BUTTON_ACTION_NEXT_DATE_INDEX = "nextdateindex"; | |
| 6082 | + final String BUTTON_ACTION_PREV_DATE_INDEX = "prevdateindex"; | |
| 6083 | + | |
| 6081 | 6084 | final Action find_action = new AbstractAction() { |
| 6082 | 6085 | @Override |
| 6083 | 6086 | public void actionPerformed(ActionEvent e) { |
| @@ -6293,6 +6296,31 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
| 6293 | 6296 | } |
| 6294 | 6297 | }; |
| 6295 | 6298 | |
| 6299 | + final Action sc_prev_date_index = new AbstractAction() { | |
| 6300 | + @Override | |
| 6301 | + public void actionPerformed(ActionEvent e) { | |
| 6302 | + switch(mainWindow.getSelectedTab()){ | |
| 6303 | + case PAPER: | |
| 6304 | + paper.moveToPrevDateIndex(); | |
| 6305 | + break; | |
| 6306 | + default: | |
| 6307 | + break; | |
| 6308 | + } | |
| 6309 | + } | |
| 6310 | + }; | |
| 6311 | + final Action sc_next_date_index = new AbstractAction() { | |
| 6312 | + @Override | |
| 6313 | + public void actionPerformed(ActionEvent e) { | |
| 6314 | + switch(mainWindow.getSelectedTab()){ | |
| 6315 | + case PAPER: | |
| 6316 | + paper.moveToNextDateIndex(); | |
| 6317 | + break; | |
| 6318 | + default: | |
| 6319 | + break; | |
| 6320 | + } | |
| 6321 | + } | |
| 6322 | + }; | |
| 6323 | + | |
| 6296 | 6324 | ArrayList<ShortCut> sca = new ArrayList<ShortCut>(); |
| 6297 | 6325 | sca.add(new ShortCut(FIND_ACTION, KeyEvent.VK_F, KeyEvent.CTRL_DOWN_MASK, find_action)); |
| 6298 | 6326 | sca.add(new ShortCut(FIND_ACTION, KeyEvent.VK_F1, 0, find_action)); |
| @@ -6355,7 +6383,11 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
| 6355 | 6383 | |
| 6356 | 6384 | sca.add(new ShortCut(BUTTON_ACTION_PREV_CENTERPAGE, KeyEvent.VK_LEFT, KeyEvent.ALT_DOWN_MASK, sc_prev_centerpage)); |
| 6357 | 6385 | sca.add(new ShortCut(BUTTON_ACTION_NEXT_CENTERPAGE, KeyEvent.VK_RIGHT, KeyEvent.ALT_DOWN_MASK, sc_next_centerpage)); |
| 6358 | -// sca.add(new ShortCut(SCROLL_ACTION_PREV_PAGE, KeyEvent.VK_PAGE_UP, 0, sc_prev_page)); | |
| 6386 | + | |
| 6387 | + sca.add(new ShortCut(BUTTON_ACTION_PREV_DATE_INDEX, KeyEvent.VK_LEFT, KeyEvent.SHIFT_DOWN_MASK + KeyEvent.ALT_DOWN_MASK, sc_prev_date_index)); | |
| 6388 | + sca.add(new ShortCut(BUTTON_ACTION_NEXT_DATE_INDEX, KeyEvent.VK_RIGHT, KeyEvent.SHIFT_DOWN_MASK + KeyEvent.ALT_DOWN_MASK, sc_next_date_index)); | |
| 6389 | + | |
| 6390 | + // sca.add(new ShortCut(SCROLL_ACTION_PREV_PAGE, KeyEvent.VK_PAGE_UP, 0, sc_prev_page)); | |
| 6359 | 6391 | // sca.add(new ShortCut(SCROLL_ACTION_NEXT_PAGE, KeyEvent.VK_PAGE_DOWN, 0, sc_next_page)); |
| 6360 | 6392 | // |
| 6361 | 6393 | // sca.add(new ShortCut(SCROLL_ACTION_PREV_PAGE, KeyEvent.VK_PAGE_UP, KeyEvent.SHIFT_DOWN_MASK, sc_prev_page)); |