Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion TeXmacs/misc/themes/liii.css
Original file line number Diff line number Diff line change
Expand Up @@ -900,12 +900,25 @@ QWidget#text_toolbar {
border-radius: 8px;
}

/*macOS 文本工具栏窗口样式*/
QWidget#text_toolbar[platform="mac"] {
border-radius: 6px;
}

/*文本工具栏按钮样式*/
QToolButton#text-toolbar-button {
background-color: transparent;
background-color: transparent;
border: none;
}

/*macOS 文本工具栏按钮样式*/
QToolButton#text-toolbar-button[platform="mac"] {
min-width: 20px;
min-height: 20px;
max-width: 20px;
max-height: 20px;
}

/*文本工具栏按钮悬停样式*/
QToolButton#text-toolbar-button:hover {
background-color: rgba(128, 128, 128, 0.3);
Expand Down
2 changes: 1 addition & 1 deletion TeXmacs/progs/generic/text-toolbar.scm
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
((balloon (icon "tm_cell_center.xpm") "center")
(make 'padded-center))
((balloon (icon "tm_cell_right.xpm") "right aligned")
(make 'padded-right-aligned)))
(make 'padded-right-aligned)))
3 changes: 3 additions & 0 deletions devel/201_63.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- 选中一段文本,测试是否会弹出文本工具栏
- 点击工具栏外部,测试是否会隐藏
- 滚动页面,测试工具栏是否跟随移动
- 额外检查macos上文本选中悬浮框尺寸是否合适

2. **显示条件测试**

Expand Down Expand Up @@ -56,6 +57,8 @@
- 有效选区矩形计算
- 坐标转换一致性

## 2026/3/20 针对macos特调css

## 2026/3/13 通过 scheme 加入具体的按钮
### What
- 添加功能按键
Expand Down
2 changes: 1 addition & 1 deletion src/Edit/Interface/edit_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ edit_interface_rep::notify_change (int change) {
if ((change & (THE_TREE | THE_SELECTION | THE_CURSOR)) != 0)
manual_focus_set (path (), (change & THE_TREE) != 0);
// 选区变化时,使文本工具栏缓存失效
// 输入字符时选区变化会触发 THE_SELECTION,进而隐藏工具栏
// 输入字符时选区变化会触发 THE_SELECTION,进而使工具栏缓存失效并隐藏
if ((change & THE_SELECTION) != 0) invalidate_text_toolbar_cache ();
}

Expand Down
10 changes: 6 additions & 4 deletions src/Plugins/Qt/QTMTextToolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ QTMTextToolbar::QTMTextToolbar (QWidget* parent, qt_simple_widget_rep* owner)
setAttribute (Qt::WA_ShowWithoutActivating);
setMouseTracking (true);
setFocusPolicy (Qt::NoFocus);
#if defined(Q_OS_MAC)
setProperty ("platform", "mac");
#endif
layout= new QHBoxLayout (this);
layout->setContentsMargins (0, 0, 0, 0);
layout->setSizeConstraint (QLayout::SetMinimumSize);
Expand Down Expand Up @@ -126,6 +129,9 @@ QTMTextToolbar::rebuildButtonsFromScheme () {
button->setAutoRaise (true);
button->setDefaultAction (action);
button->setPopupMode (QToolButton::InstantPopup);
#if defined(Q_OS_MAC)
button->setProperty ("platform", "mac");
#endif
if (tm_style_sheet == "") button->setStyle (qtmstyle ());
layout->addWidget (button);
}
Expand Down Expand Up @@ -286,11 +292,7 @@ QTMTextToolbar::autoSize () {
Scale * cached_magf * 12.0; // 原始3.0倍,扩大4倍后为12.0倍
int btn_size;

#if defined(Q_OS_MAC)
btn_size= int (50 * totalScale);
#else
btn_size= int (40 * totalScale);
#endif

if (cached_magf <= 0.16) {
btn_size= 25;
Expand Down
Loading