diff --git a/.classpath b/.classpath index 0750fbc..f34cc7d 100644 --- a/.classpath +++ b/.classpath @@ -41,7 +41,7 @@ - + diff --git a/build.xml b/build.xml index 6ed9b12..5f4b80d 100644 --- a/build.xml +++ b/build.xml @@ -11,7 +11,7 @@ - + diff --git a/css/dark.css b/css/dark.css index 58c9402..9fdded8 100644 --- a/css/dark.css +++ b/css/dark.css @@ -10,7 +10,7 @@ } body { - background: var(--gray160); + background: var(--gray190); color: var(--gray10); fill: var(--gray10); stroke: var(--gray10); @@ -19,6 +19,9 @@ body { .hdivider { width: 2px; background: transparent; + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMiIgaGVpZ2h0PSIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjQiIGZpbGw9IndoaXRlIiAvPiAKPHJlY3QgeD0iMCIgeT0iNCIgd2lkdGg9IjIiIGhlaWdodD0iNCIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSIwIiB5PSI4IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJ3aGl0ZSIgLz4gCjxyZWN0IHg9IjAiIHk9IjEyIiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjAiIHk9IjE2IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJ3aGl0ZSIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; height: 100%; position: relative; cursor: col-resize; @@ -26,16 +29,33 @@ body { z-index: 5; } +.hdivider:hover { + background: var(--ClassicBlue50); + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMiIgaGVpZ2h0PSIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjQiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iMCIgeT0iNCIgd2lkdGg9IjIiIGhlaWdodD0iNCIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSIwIiB5PSI4IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjAiIHk9IjEyIiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjAiIHk9IjE2IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; +} + .vdivider { width: 100%; height: 2px; background: transparent; + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0IiBoZWlnaHQ9IjIiIGZpbGw9IndoaXRlIiAvPiAKPHJlY3QgeD0iNCIgeT0iMCIgd2lkdGg9IjQiIGhlaWdodD0iMiIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSI4IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJ3aGl0ZSIgLz4gCjxyZWN0IHg9IjEyIiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjE2IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJ3aGl0ZSIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; position: relative; cursor: row-resize; display: block; z-index: 5; } +.vdivider:hover { + background: var(--ClassicBlue50); + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0IiBoZWlnaHQ9IjIiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iNCIgeT0iMCIgd2lkdGg9IjQiIGhlaWdodD0iMiIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSI4IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjEyIiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjE2IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; +} + .wait { cursor: wait !important; } diff --git a/css/highcontrast.css b/css/highcontrast.css new file mode 100644 index 0000000..4db0a0d --- /dev/null +++ b/css/highcontrast.css @@ -0,0 +1,838 @@ +@import "./theme.css"; +@import "./neutrals.css"; + +:root { + --error-color: #d50000; + --even-unit: #2979ff; + --odd-unit: #f44336; + --orange: #ff9100; + --teal: #8bc34a; +} + +body { + background: var(--black); + color: var(--white); + fill: var(--white); + stroke: var(--white); +} + +.hdivider { + width: 2px; + height: 100%; + background: var(--white); + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMiIgaGVpZ2h0PSIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjQiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iMCIgeT0iNCIgd2lkdGg9IjIiIGhlaWdodD0iNCIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSIwIiB5PSI4IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjAiIHk9IjEyIiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjAiIHk9IjE2IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; + position: relative; + cursor: col-resize; + display: block; + z-index: 5; +} + +.hdivider:hover { + background: var(--ClassicBlue50); + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMiIgaGVpZ2h0PSIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjQiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iMCIgeT0iNCIgd2lkdGg9IjIiIGhlaWdodD0iNCIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSIwIiB5PSI4IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjAiIHk9IjEyIiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjAiIHk9IjE2IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; +} + +.vdivider { + width: 100%; + height: 2px; + background: var(--white); + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0IiBoZWlnaHQ9IjIiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iNCIgeT0iMCIgd2lkdGg9IjQiIGhlaWdodD0iMiIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSI4IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjEyIiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjE2IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; + position: relative; + cursor: row-resize; + display: block; + z-index: 5; +} + +.vdivider:hover { + background: var(--ClassicBlue50); + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0IiBoZWlnaHQ9IjIiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iNCIgeT0iMCIgd2lkdGg9IjQiIGhlaWdodD0iMiIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSI4IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjEyIiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjE2IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; +} + +.wait { + cursor: wait !important; +} + +header { + background: var(--ClassicBlue90); + color: var(--white); + border-bottom: solid 2px var(--ClassicBlue90); +} + +footer { + background: var(--ClassicBlue90); + color: var(--white); + border-top: 2px solid var(--ClassicBlue90); +} + +a { + color: var(--ClassicBlue90); + cursor: pointer; +} + +a:hover { + text-decoration: underline; +} + +.status { + position: absolute; + top: 200px; + left: calc(40% - 100px); + /* width: 200px; */ + margin: auto; + background-color: var(--ClassicBlue50); + color: var(--black); + padding: 20px; + border-radius: 8px; +} + +/* tables */ + +table { + width: 100%; + border-collapse: collapse; +} + +thead { + height: 26px; + background: var(--ClassicBlue90); + color: var(--white); +} + +thead tr { + position: sticky; + z-index: 5; + background: inherit !important; + color: inherit !important; + border: none !important; +} + +tbody { + overflow-y: scroll; + overflow-x: scroll; +} + +td { + padding: 8px 4px; + vertical-align: top; + font-size: medium; +} + +td.list { + vertical-align: middle; + white-space: nowrap; +} + +td.editing { + background-color: var(--black) !important; + outline: none !important; +} + +td.fixed { + text-align: center; + vertical-align: middle; + color: var(--white); + cursor: default !important; +} + +td.initial { + border-right: 2px solid var(--white); +} + +td.translated { + border-right: 2px solid var(--orange); +} + +td.reviewed { + border-right: 2px solid var(--orange); +} + +td.final { + border-right: 2px solid var(--teal); +} + +tr.selected { + background-color: var(--black) !important; +} + +.discover tr:hover { + background-color: var(--ClassicBlue100) !important; +} + +th { + position: sticky; + z-index: 5; + padding: 0px 4px; + top: 0; + font-weight: 300; + background: var(--ClassicBlue90); + color: var(--white); + fill: var(--white); + stroke: var(--white); + border-bottom: 2px solid var(--ClassicBlue90); +} + +.left { + text-align: left; +} + +.stripes tr { + border-top: 2px solid var(--white); + border-bottom: 2px solid var(--white); +} + +.currentRow { + border-top: 3px solid var(--ClassicBlue50) !important; + border-bottom: 3px solid var(--ClassicBlue50) !important; + background-color: var(--black) !important; +} + +.sourceContainer { + background-color: var(--gray190); + padding: 4px; + margin: 0; + width: 100%; + white-space: pre-wrap; + border-bottom: 1px solid var(--ClassicBlue50); +} + +.targetContainer { + background-color: var(--gray190); + padding: 4px; + margin: 0; + width: 100%; + white-space: pre-wrap; + border-bottom: 1px solid var(--gray160); +} + +.machineContainer { + background-color: var(--gray190); + padding: 4px; + margin: 0; + width: 100%; + white-space: pre-wrap; +} + +.fixed { + width: 1px; + text-align: center; +} + +.highlighted { + color: var(--white); + background-color: var(--ClassicBlue90); + padding-left: 2px; + padding-right: 2px; + border-radius: 2px; +} + +.difference { + color: var(--black); + background-color: var(--ClassicBlue30); + padding-left: 2px; + padding-right: 2px; + border-radius: 2px; +} + +.right { + float: right; +} + +.hidden { + display: none; +} + +.center { + text-align: center; +} + +.middle { + vertical-align: middle; +} + +/* inputs */ + +input { + background-color: var(--gray190); + color: var(--white); + border: 1px solid var(--white); + margin-top: 3px; + height: 1.4rem; + font-size: 1rem; + border-radius: 2px; +} + +.table_input { + width: calc(100% - 10px); +} + +.table_select { + width: calc(100% - 4px); +} + +input:focus { + outline: none !important; + border: 1px solid var(--ClassicBlue50); +} + +input:focus+label { + color: var(--ClassicBlue50); +} + +input:disabled { + background-color: var(--gray160); +} + +input[type=number] { + font-size: 0.8em; + width: 40px; + margin: 0; + padding: 0; + padding-left: 2px; +} + +select { + background-color: var(--gray190); + color: var(--white); + border: 1px solid var(--white); + font-size: 1em; + height: 1.6em; + border-radius: 2px; +} + +select:disabled { + background-color: var(--gray160); +} + +select:focus { + outline: none !important; + border: 1px solid var(--ClassicBlue50); +} + +option { + font-size: 1em; + background-color: var(--black); + color: var(--white); +} + +.optionBox { + border: 1px solid var(--gray160); + border-radius: 4px; +} + +textarea { + padding: 0; + font-size: medium; + background-color: var(--gray190); + color: var(--white); + border: 1px solid var(--gray160); + outline: none; +} + +textarea:focus { + outline: none !important; + border: 1px solid var(--ClassicBlue50); +} + +button { + color: var(--white); + background: var(--ClassicBlue100); + border: 1px solid var(--ClassicBlue100); + border-radius: 4px; + font-size: 1em; + text-align: center; + margin: 4px; + padding-left: 8px; + padding-right: 8px; + white-space: nowrap; +} + +button:focus { + outline: none !important; + background: var(--ClassicBlue90); +} + +button:hover { + background: var(--ClassicBlue90); + border: 1px solid var(--ClassicBlue90); + transition-property: all; + transition-duration: 0.5s; + transition-timing-function: cubic-bezier(0.14, 0.71, 0.38, 1); + transition-delay: 0s; +} + +.row { + display: flex; + flex-direction: row; + width: 100%; + padding: 0; +} + +label { + padding-left: 4px; + padding-right: 4px; +} + +.column { + display: flex; + flex-direction: column; +} + +.fill_width { + width: 100%; +} + +.form_height { + height: 2rem; +} + +.noWrap { + white-space: nowrap; +} + +.paddedArea { + padding: 4px; + margin: 4px; +} + +.buttonArea { + display: flex; + flex-direction: row; + padding: 8px 16px; + justify-content: flex-end; +} + +.inputArea { + display: flex; + flex-direction: row; + vertical-align: middle; +} + +/* toolbars */ + +.toolbar { + display: flex; + flex-direction: row; + background: var(--ClassicBlue100); + color: var(--white); + fill: var(--ClassicBlue90); + stroke: var(--ClassicBlue90); + padding: 2px 4px; + justify-content: flex-start; +} + +.toolbar button { + padding: 4px; + background: inherit; + border: none; + outline: none; + color: inherit; + fill: inherit; + stroke: inherit; + text-align: left; + font-size: 0.8em; + vertical-align: middle; + box-shadow: none; +} + +.toolbar button img { + padding: 4px; +} + +.toolbar a { + color: inherit; + fill: inherit; + stroke: inherit; + margin-left: 2px; + margin-right: 2px; +} + +.toolbar a img { + padding-top: 4px; +} + +.toolbar a svg { + padding-top: 4px; + color: var(--white); + fill: var(--white); + stroke: var(--white); +} + +.toolbar a:hover { + background-color: var(--gray190); + text-decoration: none !important; + transition-property: all; + transition-duration: 0.5s; + transition-timing-function: cubic-bezier(0.14, 0.71, 0.38, 1); + transition-delay: 0s; + border-radius: 2px; +} + +svg { + fill: var(--white); + stroke: var(--white); + stroke-width: 0.1; +} + +th svg { + margin-top: 4px; + fill: var(--white) !important; + stroke: var(--white) !important; +} + +/* tabs */ + +.tabHolder { + display: flex; + flex-flow: row; + color: var(--white); + margin: 0px; + padding: 0px 0px 0px 8px; +} + +.tab { + overflow: hidden; + background: var(--gray190); + color: var(--white); + fill: var(--white); + stroke: var(--white); + padding: 4px 16px; + margin: 0; + vertical-align: middle; + box-shadow: none !important; + text-decoration: none !important; + border-bottom: 1px solid var(--white); +} + +.selectedTab { + background: var(--ClassicBlue100); + color: var(--white); + border-left: 2px solid var(--white) !important; + border-right: 2px solid var(--white) !important; + border-bottom: 2px solid var(--ClassicBlue100); +} + +.tab:hover { + color: var(--ClassicBlue50); + fill: var(--ClassicBlue50); + stroke: var(--ClassicBlue50); +} + +.selectedTab:hover { + color: var(--white); + fill: var(--white); + stroke: var(--white); +} + +.tab a { + color: inherit; + fill: inherit; + stroke: inherit; + text-decoration: none; + cursor: pointer; +} + +.tab a:hover { + color: inherit; + fill: inherit; + stroke: inherit; +} + +.tabContent { + display: block; +} + +.panel { + z-index: 5; + display: block; + overflow-y: scroll; +} + +.titlepanel { + margin: 0; + padding-top: 0; + padding-left: 4px; + border-radius: 4px 4px 0px 0px; + background: var(--ClassicBlue90); + color: var(--white); + white-space: nowrap; + overflow-x: hidden; + height: 26px; + vertical-align: middle; +} + +.roundedBottom { + border-radius: 0px 0px 4px 4px; +} + +.panelcontent { + z-index: -20; + display: block; + width: 100%; + overflow-y: auto; + overflow-x: auto; +} + +.panelcontent table { + z-index: -30; +} + +/* tooltips */ + +.tooltip { + position: relative; + display: inline-block; +} + +.tooltip .tooltiptext { + background-color: var(--ClassicBlue30); + color: var(--black); + visibility: hidden; + padding: 4px; + border-radius: 2px; + white-space: nowrap; + /* Position the tooltip */ + position: absolute; + z-index: 100; +} + +.topTooltip { + bottom: 120%; + left: 20px; +} + +.bottomTooltip { + top: 120%; + left: 20px; +} + +.bottomCenterTooltip { + top: 120%; + left: -80px; +} + +.bottomRightTooltip { + top: 120%; + right: 20px; +} + +.tooltip:hover .tooltiptext { + visibility: visible; +} + +.iconTooltip { + position: relative; + display: inline-block; +} + +.iconTooltip .tooltiptext { + background-color: var(--ClassicBlue30); + color: var(--black); + visibility: hidden; + padding: 4px; + border-radius: 4px; + white-space: nowrap; + /* Position the tooltip */ + position: absolute; + z-index: 100; +} + +.iconTooltip:hover .tooltiptext { + visibility: visible; +} + +.highlight { + color: var(--white); +} + +.active svg { + stroke: var(--ClassicBlue90) !important; + fill: var(--ClassicBlue90) !important; +} + +.bordered { + border: 1px solid var(--white) !important; + border-radius: 2px; +} + +.error { + color: var(--error-color) !important; +} + +.preserve { + white-space: pre-wrap; +} + +.divContainer { + /* Any container that needs to scroll content */ + width: 100%; + height: 100%; + overflow: auto; +} + +div.stats { + white-space: nowrap; + display: flex; + flex-direction: row; +} + +span.stats { + margin-top: 4px; + padding-left: 4px; + padding-right: 4px; +} + +svg.stats { + margin-top: 4px; + cursor: default; +} + +.statsRect { + stroke-width: 1; + stroke: var(--white); + fill: var(--white); +} + +.statsFiller { + stroke: none; + fill: var(--ClassicBlue50); +} + +.statsText { + dominant-baseline: middle; + text-anchor: middle; + fill: var(--black); +} + +.space { + background: var(--ClassicBlue50); + border-radius: 2px; + font-weight: 700; +} + +.splitting { + background: var(--themePrimaryDark); +} + +.evenUnit { + border-right-color: var(--even-unit) !important; +} + +.oddUnit { + border-right-color: var(--odd-unit) !important; +} + +.paddedPanel { + margin-top: 8px; + margin-right: 8px; + margin-left: 8px; + margin-bottom: 8px; + border-radius: 4px; + width: calc(100% - 16px); + height: calc(100% - 16px); + overflow: auto; + background: var(--gray190); +} + +.leftPaddedPanel { + margin-top: 8px; + margin-right: 4px; + margin-left: 8px; + margin-bottom: 8px; + border-radius: 4px; + width: calc(100% - 12px); + height: calc(100% - 16px); + overflow-y: auto; + overflow-x: hidden; + background: var(--gray190); +} + +.rightPaddedPanel { + margin: 0px; + width: 100%; + height: 100%; +} + +.topPaddedPanel { + margin-top: 8px; + margin-right: 8px; + margin-left: 4px; + margin-bottom: 4px; + border-radius: 4px; + width: calc(100% - 12px); + height: calc(100% - 12px); + background: var(--gray190); +} + +.centerPaddedPanel { + margin-top: 4px; + margin-right: 8px; + margin-left: 4px; + margin-bottom: 4px; + border-radius: 4px; + width: calc(100% - 12px); + height: calc(100% - 8px); + background: var(--gray190); +} + +.bottomPaddedPanel { + margin-top: 4px; + margin-right: 8px; + margin-left: 4px; + margin-bottom: 8px; + border-radius: 4px; + width: calc(100% - 12px); + height: calc(100% - 12px); + background: var(--gray190); +} + +::-webkit-scrollbar { + mix-blend-mode: darken; + width: 12px; + height: 12px; +} + +::-webkit-scrollbar-thumb { + min-height: 30px !important; + background-color: var(--ClassicBlue90); + border-radius: 6px; +} + +::-webkit-scrollbar-corner { + background-color: inherit; + border-radius: inherit; +} + +::-webkit-scrollbar-button { + border-radius: inherit; +} + +::-webkit-scrollbar-button { + border-radius: inherit; +} + +.arrow-down:after { + content: "\2193"; + display: inline-block; + vertical-align: text-bottom; + margin-left: 4px; +} + +.arrow-up:after { + content: "\2191"; + display: inline-block; + vertical-align: text-bottom; + margin-left: 4px; +} + +.dialogBody { + padding: 8px 0px 16px 8px; + overflow-y: hidden; +} \ No newline at end of file diff --git a/css/light.css b/css/light.css index 4081d07..930e0eb 100644 --- a/css/light.css +++ b/css/light.css @@ -10,7 +10,7 @@ } body { - background: var(--gray20); + background: var(--gray10); color: var(--gray190); fill: var(--gray190); stroke: var(--gray190); @@ -19,6 +19,9 @@ body { .hdivider { width: 2px; background: transparent; + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMiIgaGVpZ2h0PSIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjQiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iMCIgeT0iNCIgd2lkdGg9IjIiIGhlaWdodD0iNCIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSIwIiB5PSI4IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjAiIHk9IjEyIiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjAiIHk9IjE2IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; height: 100%; position: relative; cursor: col-resize; @@ -26,16 +29,33 @@ body { z-index: 5; } +.hdivider:hover { + background-color: var(--ClassicBlue50); + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMiIgaGVpZ2h0PSIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjQiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iMCIgeT0iNCIgd2lkdGg9IjIiIGhlaWdodD0iNCIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSIwIiB5PSI4IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjAiIHk9IjEyIiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjAiIHk9IjE2IiB3aWR0aD0iMiIgaGVpZ2h0PSI0IiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; +} + .vdivider { width: 100%; height: 2px; background: transparent; + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0IiBoZWlnaHQ9IjIiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iNCIgeT0iMCIgd2lkdGg9IjQiIGhlaWdodD0iMiIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSI4IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjEyIiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjE2IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; position: relative; cursor: row-resize; display: block; z-index: 5; } +.vdivider:hover { + background-color: var(--ClassicBlue50); + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0IiBoZWlnaHQ9IjIiIGZpbGw9ImJsYWNrIiAvPiAKPHJlY3QgeD0iNCIgeT0iMCIgd2lkdGg9IjQiIGhlaWdodD0iMiIgZmlsbD0idHJhbnNwYXJlbnQiIC8+IAo8cmVjdCB4PSI4IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjxyZWN0IHg9IjEyIiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJ0cmFuc3BhcmVudCIgLz4gCjxyZWN0IHg9IjE2IiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSIyIiBmaWxsPSJibGFjayIgLz4gCjwvc3ZnPg==); + background-repeat: no-repeat; + background-position: center; +} + .wait { cursor: wait !important; } diff --git a/html/about.html b/html/about.html index db14dc4..8186bf9 100644 --- a/html/about.html +++ b/html/about.html @@ -10,7 +10,7 @@

Swordfish

- about box + Swordfish icon

Copyright © 2007 - 2024 Maxprograms

diff --git a/jars/openxliff.jar b/jars/openxliff.jar index bcc0e80..64a5c98 100644 Binary files a/jars/openxliff.jar and b/jars/openxliff.jar differ diff --git a/jars/sqlite-jdbc-3.47.0.1-20241024.015404-1.jar b/jars/sqlite-jdbc-3.47.1.0.jar similarity index 62% rename from jars/sqlite-jdbc-3.47.0.1-20241024.015404-1.jar rename to jars/sqlite-jdbc-3.47.1.0.jar index 8c3d91e..3c40c09 100644 Binary files a/jars/sqlite-jdbc-3.47.0.1-20241024.015404-1.jar and b/jars/sqlite-jdbc-3.47.1.0.jar differ diff --git a/package.json b/package.json index a28df66..df0213e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "swordfish", "productName": "Swordfish", - "version": "5.8.0", + "version": "5.9.0", "description": "Swordfish Translation Editor", "main": "js/Swordfish.js", "scripts": { @@ -20,12 +20,12 @@ "url": "https://github.com/rmraya/Swordfish.git" }, "devDependencies": { - "electron": "^33.2.0", - "typescript": "^5.6.3" + "electron": "^33.2.1", + "typescript": "^5.7.2" }, "dependencies": { - "mtengines": "^2.0.0", + "mtengines": "^2.1.0", "typesxml": "^1.5.2", - "typesbcp47": "^1.4.2" + "typesbcp47": "^1.5.0" } } \ No newline at end of file diff --git a/src/com/maxprograms/swordfish/Constants.java b/src/com/maxprograms/swordfish/Constants.java index 0eb914a..e03a747 100644 --- a/src/com/maxprograms/swordfish/Constants.java +++ b/src/com/maxprograms/swordfish/Constants.java @@ -19,8 +19,8 @@ private Constants() { } public static final String APPNAME = "Swordfish"; - public static final String VERSION = "5.8.0"; - public static final String BUILD = "20241124_1736"; + public static final String VERSION = "5.9.0"; + public static final String BUILD = "20241208_1225"; public static final String REASON = "reason"; public static final String STATUS = "status"; diff --git a/src/com/maxprograms/swordfish/xliff/XliffStore.java b/src/com/maxprograms/swordfish/xliff/XliffStore.java index 47888f3..581fc46 100644 --- a/src/com/maxprograms/swordfish/xliff/XliffStore.java +++ b/src/com/maxprograms/swordfish/xliff/XliffStore.java @@ -133,6 +133,7 @@ public class XliffStore { private static boolean fuzzyTermSearches; private static boolean caseSensitiveTermSearches; private static boolean caseSensitiveMatches; + private static boolean autoConfirm; private int index; private int nextId; @@ -930,6 +931,11 @@ private static void getPreferences() throws IOException { caseSensitiveMatches = json.getBoolean("caseSensitiveMatches"); } fuzzyTermSearches = json.getBoolean("fuzzyTermSearches"); + if (json.has("autoConfirm")) { + autoConfirm = json.getBoolean("autoConfirm"); + } else { + autoConfirm = false; + } catalog = json.getString("catalog"); } @@ -1176,6 +1182,7 @@ private JSONArray propagate(Element source, Element target) tag = 1; String translation = addHtmlTags(target, "", false, false, tagsData, true); row.put("target", translation); + row.put("status", autoConfirm ? Constants.FINAL : Constants.TRANSLATED); result.put(row); Element translated = XliffUtils.buildElement("" + translation + ""); @@ -1184,7 +1191,7 @@ private JSONArray propagate(Element source, Element target) if (!translated.getChildren().isEmpty()) { translated = fixTags(sourceElement, source, target); } - updateTarget(file, unit, segment, translated, XliffUtils.pureText(translated), false); + updateTarget(file, unit, segment, translated, XliffUtils.pureText(translated), autoConfirm); } insertMatch(file, unit, segment, "Self", Constants.TM, similarity, source, target, tagsData); conn.commit(); diff --git a/src/com/maxprograms/swordfish/xliff/XliffUtils.java b/src/com/maxprograms/swordfish/xliff/XliffUtils.java index 7f438c9..2fba319 100644 --- a/src/com/maxprograms/swordfish/xliff/XliffUtils.java +++ b/src/com/maxprograms/swordfish/xliff/XliffUtils.java @@ -124,9 +124,26 @@ public static void checkSVG(int tag) throws IOException { File folder = new File(TmsServer.getWorkFolder(), "images"); if (!folder.exists()) { Files.createDirectories(folder.toPath()); + File tagColors = new File(folder, "tagColors.json"); + JSONObject colors = new JSONObject(); + colors.put("background", "#009688"); + colors.put("foreground", "#ffffff"); + try (FileOutputStream out = new FileOutputStream(tagColors)) { + out.write(colors.toString(2).getBytes(StandardCharsets.UTF_8)); + } } File f = new File(folder, tag + ".svg"); if (!f.exists()) { + File colorsFile = new File(folder, "tagColors.json"); + if (!colorsFile.exists()) { + JSONObject colors = new JSONObject(); + colors.put("background", "#009688"); + colors.put("foreground", "#ffffff"); + try (FileOutputStream out = new FileOutputStream(colorsFile)) { + out.write(colors.toString(2).getBytes(StandardCharsets.UTF_8)); + } + } + JSONObject colors = TmsServer.readJSON(colorsFile); int width = 16; if (tag >= 10) { width = 22; @@ -136,9 +153,11 @@ public static void checkSVG(int tag) throws IOException { } String svg = "" + "" - + "\n" + + "\n" + "" + tag + ""; try (FileOutputStream out = new FileOutputStream(f)) { out.write(svg.getBytes(StandardCharsets.UTF_8)); diff --git a/swordfish.pdf b/swordfish.pdf index f30ab2d..02a5e3e 100644 Binary files a/swordfish.pdf and b/swordfish.pdf differ diff --git a/ts/Main.ts b/ts/Main.ts index e1d74d6..a174077 100644 --- a/ts/Main.ts +++ b/ts/Main.ts @@ -24,6 +24,7 @@ class Main { memoriesView: MemoriesView; glossariesView: GlossariesView; + static rowsPage: number; constructor() { Main.translationViews = new Map(); @@ -76,6 +77,10 @@ class Main { Main.electron.ipcRenderer.on('set-theme', (event: Electron.IpcRendererEvent, arg: any) => { (document.getElementById('theme') as HTMLLinkElement).href = arg; }); + Main.electron.ipcRenderer.send('get-rows-page'); + Main.electron.ipcRenderer.on('set-rows-page', (event: Electron.IpcRendererEvent, rows:number) => { + Main.rowsPage = rows; + }); Main.electron.ipcRenderer.on('request-theme', () => { Main.electron.ipcRenderer.send('get-theme'); }); @@ -391,6 +396,14 @@ class Main { Main.electron.ipcRenderer.on('edit-source', () => { this.editSource(); }); + Main.electron.ipcRenderer.on('tags-deleted', () => { + if (Main.translationViews.size > 0) { + Main.electron.ipcRenderer.send('show-message', { + type: 'info', + message: 'Tag colors will be adjusted on application restart.' + }); + } + }); let config: MutationObserverInit = { attributes: true, childList: false, subtree: false }; let observer = new MutationObserver((mutationsList) => { for (let mutation of mutationsList) { @@ -499,20 +512,20 @@ class Main { } } - addTab(arg: Project): void { - if (Main.tabHolder.has(arg.id)) { - Main.tabHolder.selectTab(arg.id); + addTab(project: Project): void { + if (Main.tabHolder.has(project.id)) { + Main.tabHolder.selectTab(project.id); return; } - let tab = new Tab(arg.id, arg.description, true); - let view: TranslationView = new TranslationView(tab, arg.id, arg.sourceLang, arg.targetLang); + let tab = new Tab(project.id, project.description, true); + let view: TranslationView = new TranslationView(tab, project.id, project.sourceLang, project.targetLang, Main.rowsPage); Main.tabHolder.addTab(tab); - Main.tabHolder.selectTab(arg.id); + Main.tabHolder.selectTab(project.id); tab.getLabelDiv().addEventListener('click', () => { view.setSize(); view.setSpellChecker(); }); - Main.translationViews.set(arg.id, view); + Main.translationViews.set(project.id, view); } closeTab(): void { diff --git a/ts/Swordfish.ts b/ts/Swordfish.ts index a31f41a..cb953ba 100644 --- a/ts/Swordfish.ts +++ b/ts/Swordfish.ts @@ -13,7 +13,7 @@ import { ChildProcessWithoutNullStreams, execFileSync, spawn } from "child_process"; import { BrowserWindow, ClientRequest, IpcMainEvent, Menu, MenuItem, Rectangle, Size, app, clipboard, dialog, ipcMain, nativeTheme, net, screen, session, shell } from "electron"; import { IncomingMessage } from "electron/main"; -import { appendFileSync, existsSync, lstatSync, mkdirSync, readFile, readFileSync, readdirSync, unlinkSync, writeFileSync } from "fs"; +import { appendFileSync, existsSync, lstatSync, mkdirSync, readFile, readFileSync, readdirSync, rmSync, unlinkSync, writeFileSync } from "fs"; import { Locations, Point } from "./locations"; import { MTManager } from "./mtManager"; @@ -22,7 +22,7 @@ export class Swordfish { static readonly path = require('path'); static mainWindow: BrowserWindow; - static settingsWindow: BrowserWindow; + static preferencesWindow: BrowserWindow; static aboutWindow: BrowserWindow; static licensesWindow: BrowserWindow; static addMemoryWindow: BrowserWindow; @@ -82,6 +82,7 @@ export class Swordfish { fuzzyTermSearches: false, caseSensitiveSearches: false, caseSensitiveMatches: true, + autoConfirm: false, google: { enabled: false, apiKey: '', @@ -117,8 +118,10 @@ export class Swordfish { defaultSpanish: 'es' }, os: process.platform, - showGuide: true + showGuide: true, + pageRows: 500 } + static currentCss: string; static currentStatus: any; @@ -222,17 +225,33 @@ export class Swordfish { }); nativeTheme.on('updated', () => { + let oldCss: string = Swordfish.currentCss; + let dark: string = 'file://' + Swordfish.path.join(app.getAppPath(), 'css', 'dark.css'); + let light: string = 'file://' + Swordfish.path.join(app.getAppPath(), 'css', 'light.css'); + let highcontrast: string = 'file://' + Swordfish.path.join(app.getAppPath(), 'css', 'highcontrast.css'); if (Swordfish.currentPreferences.theme === 'system') { if (nativeTheme.shouldUseDarkColors) { - Swordfish.currentCss = 'file://' + Swordfish.path.join(app.getAppPath(), 'css', 'dark.css'); + Swordfish.currentCss = dark; } else { - Swordfish.currentCss = 'file://' + Swordfish.path.join(app.getAppPath(), 'css', 'light.css'); + Swordfish.currentCss = light; + } + if (nativeTheme.shouldUseHighContrastColors) { + Swordfish.currentCss = highcontrast; } let windows: BrowserWindow[] = BrowserWindow.getAllWindows(); for (let window of windows) { window.webContents.send('set-theme', Swordfish.currentCss); } } + if ((oldCss === dark || oldCss === light) && Swordfish.currentCss === highcontrast) { + Swordfish.deleteAllTags('#C5E1A5', '#000000'); + } + if ((oldCss === highcontrast) && (Swordfish.currentCss === dark || Swordfish.currentCss === light)) { + Swordfish.deleteAllTags('#009688', '#ffffff'); + } + }); + ipcMain.on('get-rows-page', (event: IpcMainEvent) => { + event.sender.send('set-rows-page', Swordfish.currentPreferences.pageRows); }); ipcMain.on('get-projects', (event: IpcMainEvent) => { Swordfish.getProjects(event); @@ -492,7 +511,7 @@ export class Swordfish { event.sender.send('set-version', app.name + ' ' + app.getVersion()); }); ipcMain.on('close-preferences', () => { - Swordfish.destroyWindow(Swordfish.settingsWindow); + Swordfish.destroyWindow(Swordfish.preferencesWindow); }); ipcMain.on('close-defaultLangs', () => { Swordfish.destroyWindow(Swordfish.defaultLangsWindow); @@ -500,6 +519,10 @@ export class Swordfish { ipcMain.on('get-preferences', (event: IpcMainEvent) => { event.sender.send('set-preferences', Swordfish.currentPreferences); }); + ipcMain.on('preferences-set', () => { + Swordfish.preferencesWindow.show(); + Swordfish.mainWindow.webContents.send('end-waiting'); + }); ipcMain.on('browse-projects', (event: IpcMainEvent) => { this.browseProjects(event); }); @@ -864,6 +887,19 @@ export class Swordfish { }); } // end constructor + static deleteAllTags(background: string, foreground: string): void { + let tagsFolder: string = Swordfish.path.join(app.getPath('userData'), 'images'); + if (existsSync(tagsFolder)) { + rmSync(tagsFolder, { recursive: true, force: true }); + } + mkdirSync(tagsFolder); + let colors: any = { background: background, foreground: foreground }; + writeFileSync(Swordfish.path.join(app.getPath('userData'), 'images', 'tagColors.json'), JSON.stringify(colors, null, 2)); + if (app.isReady()) { + Swordfish.mainWindow.webContents.send('tags-deleted'); + } + } + static createWindow(): void { if (Swordfish.currentDefaults === undefined) { let size: Size = screen.getPrimaryDisplay().workAreaSize; @@ -1118,7 +1154,7 @@ export class Swordfish { new MenuItem({ label: 'About...', click: () => { this.showAbout(); } }), new MenuItem({ label: 'Preferences...', submenu: [ - { label: 'Settings', accelerator: 'Cmd+,', click: () => { this.showSettings(); } } + { label: 'Settings', accelerator: 'Cmd+,', click: () => { this.showPreferences(); } } ] }), new MenuItem({ type: 'separator' }), @@ -1135,7 +1171,7 @@ export class Swordfish { let help: MenuItem = template.pop(); template.push(new MenuItem({ label: '&Settings', submenu: [ - { label: 'Preferences', click: () => { this.showSettings(); } } + { label: 'Preferences', click: () => { this.showPreferences(); } } ] })); template.push(help); @@ -1244,8 +1280,8 @@ export class Swordfish { if ('termSearch' === arg.window) { Swordfish.termSearchWindow.setContentSize(arg.width, arg.height, true); } - if ('settings' === arg.window) { - Swordfish.settingsWindow.setContentSize(arg.width, arg.height, true); + if ('preferences' === arg.window) { + Swordfish.preferencesWindow.setContentSize(arg.width, arg.height, true); } if ('defaultLangs' === arg.window) { Swordfish.defaultLangsWindow.setContentSize(arg.width, arg.height, true); @@ -1300,7 +1336,9 @@ export class Swordfish { static loadPreferences(): void { let dark: string = 'file://' + Swordfish.path.join(app.getAppPath(), 'css', 'dark.css'); let light: string = 'file://' + Swordfish.path.join(app.getAppPath(), 'css', 'light.css'); + let highContrast = 'file://' + Swordfish.path.join(app.getAppPath(), 'css', 'highcontrast.css'); let preferencesFile = Swordfish.path.join(app.getPath('appData'), app.name, 'preferences.json'); + let oldCss = Swordfish.currentCss; if (existsSync(preferencesFile)) { try { let data: Buffer = readFileSync(preferencesFile); @@ -1319,6 +1357,12 @@ export class Swordfish { tgtLang: 'none' } } + if (!json.hasOwnProperty('pageRows')) { + json.pageRows = 500; + } + if (!json.hasOwnProperty('autoConfirm')) { + json.autoConfirm = false; + } Swordfish.currentPreferences = json; if (!Swordfish.currentPreferences.projectsFolder || !existsSync(Swordfish.currentPreferences.projectsFolder)) { Swordfish.currentPreferences.projectsFolder = Swordfish.path.join(app.getPath('appData'), app.name, 'projects'); @@ -1340,6 +1384,9 @@ export class Swordfish { Swordfish.currentPreferences.srx = Swordfish.path.join(app.getAppPath(), 'srx', 'default.srx'); writeFileSync(Swordfish.path.join(app.getPath('appData'), app.name, 'preferences.json'), JSON.stringify(Swordfish.currentPreferences, null, 2)); } + if (Swordfish.mainWindow) { + Swordfish.mainWindow.webContents.send('set-rows-page', Swordfish.currentPreferences.pageRows); + } } catch (err) { console.error(err); } @@ -1352,6 +1399,9 @@ export class Swordfish { } else { Swordfish.currentCss = light; } + if (nativeTheme.shouldUseHighContrastColors) { + Swordfish.currentCss = highContrast; + } } if (Swordfish.currentPreferences.theme === 'dark') { Swordfish.currentCss = dark; @@ -1359,6 +1409,15 @@ export class Swordfish { if (Swordfish.currentPreferences.theme === 'light') { Swordfish.currentCss = light; } + if (Swordfish.currentPreferences.theme === 'highcontrast') { + Swordfish.currentCss = highContrast; + } + if ((oldCss === dark || oldCss === light) && Swordfish.currentCss === highContrast) { + Swordfish.deleteAllTags('#C5E1A5', '#000000'); + } + if (oldCss === highContrast && (Swordfish.currentCss === light || Swordfish.currentCss === dark)) { + Swordfish.deleteAllTags('#009688', '#ffffff'); + } if (!Swordfish.currentPreferences.zoomFactor) { Swordfish.currentPreferences.zoomFactor = '1.0'; } @@ -1368,7 +1427,7 @@ export class Swordfish { } static savePreferences(preferences: Preferences): void { - Swordfish.destroyWindow(Swordfish.settingsWindow); + Swordfish.destroyWindow(Swordfish.preferencesWindow); let reloadProjects: boolean = this.currentPreferences.projectsFolder !== preferences.projectsFolder; let reloadMemories: boolean = this.currentPreferences.memoriesFolder !== preferences.memoriesFolder; let reloadGlossaries: boolean = this.currentPreferences.glossariesFolder !== preferences.glossariesFolder; @@ -2193,8 +2252,9 @@ export class Swordfish { }); } - static showSettings(): void { - this.settingsWindow = new BrowserWindow({ + static showPreferences(): void { + this.mainWindow.webContents.send('start-waiting'); + this.preferencesWindow = new BrowserWindow({ parent: this.mainWindow, width: 640, height: 340, @@ -2208,15 +2268,17 @@ export class Swordfish { contextIsolation: false } }); - this.settingsWindow.setMenu(null); - this.settingsWindow.loadURL('file://' + this.path.join(app.getAppPath(), 'html', 'preferencesDialog.html')); - this.settingsWindow.once('ready-to-show', () => { - this.settingsWindow.show(); + this.preferencesWindow.setMenu(null); + this.preferencesWindow.loadURL('file://' + this.path.join(app.getAppPath(), 'html', 'preferencesDialog.html')); + this.preferencesWindow.once('ready-to-show', () => { + let mtManager: MTManager = new MTManager(Swordfish.currentPreferences, '', ''); + this.preferencesWindow.webContents.send('set-mt-languages', mtManager.getMTLanguages()); + this.preferencesWindow.show(); }); - this.settingsWindow.on('close', () => { + this.preferencesWindow.on('close', () => { this.mainWindow.focus(); }); - Swordfish.setLocation(this.settingsWindow, 'preferencesDialog.html'); + Swordfish.setLocation(this.preferencesWindow, 'preferencesDialog.html'); } static showSystemInfo() { @@ -3348,7 +3410,7 @@ export class Swordfish { static showSpellCheckerLangs(): void { Swordfish.spellingLangsWindow = new BrowserWindow({ - parent: this.settingsWindow, + parent: this.preferencesWindow, width: 790, height: 530, minimizable: false, @@ -3367,7 +3429,7 @@ export class Swordfish { Swordfish.spellingLangsWindow.show(); }); this.spellingLangsWindow.on('close', () => { - this.settingsWindow.focus(); + this.preferencesWindow.focus(); }); Swordfish.setLocation(this.spellingLangsWindow, 'spellingLangs.html'); } @@ -3437,7 +3499,7 @@ export class Swordfish { break; case 'importXliff': parent = Swordfish.importXliffWindow; break; - case 'preferences': parent = Swordfish.settingsWindow; + case 'preferences': parent = Swordfish.preferencesWindow; break; case 'replaceText': parent = Swordfish.replaceTextWindow; break; @@ -5261,7 +5323,7 @@ export class Swordfish { static editXmlFilter(arg: any): void { Swordfish.xmlFilter = arg.file; Swordfish.editXmlFilterWindow = new BrowserWindow({ - parent: Swordfish.settingsWindow, + parent: Swordfish.preferencesWindow, width: 800, height: 405, minimizable: false, @@ -5281,7 +5343,7 @@ export class Swordfish { Swordfish.editXmlFilterWindow.show(); }); this.editXmlFilterWindow.on('close', () => { - this.settingsWindow.focus(); + this.preferencesWindow.focus(); }); Swordfish.setLocation(this.editXmlFilterWindow, 'filterConfig.html'); } @@ -5398,7 +5460,7 @@ export class Swordfish { } ); } else { - Swordfish.settingsWindow.focus(); + Swordfish.preferencesWindow.focus(); } }).catch((error: Error) => { console.error(error.message); @@ -5447,7 +5509,7 @@ export class Swordfish { } ); } else { - Swordfish.settingsWindow.focus(); + Swordfish.preferencesWindow.focus(); } }).catch((error: Error) => { console.error(error.message); @@ -5457,7 +5519,7 @@ export class Swordfish { static showAddXmlConfiguration(event: IpcMainEvent): void { Swordfish.addConfigurationEvent = event; Swordfish.addXmlConfigurationWindow = new BrowserWindow({ - parent: Swordfish.settingsWindow, + parent: Swordfish.preferencesWindow, width: 450, height: 150, minimizable: false, @@ -5477,7 +5539,7 @@ export class Swordfish { Swordfish.addXmlConfigurationWindow.show(); }); this.addXmlConfigurationWindow.on('close', () => { - this.settingsWindow.focus(); + this.preferencesWindow.focus(); }); Swordfish.setLocation(this.addXmlConfigurationWindow, 'addXmlConfiguration.html'); } @@ -5490,7 +5552,7 @@ export class Swordfish { Swordfish.showMessage({ type: 'info', message: 'Configuration added' }); Swordfish.getXMLFilters(Swordfish.addConfigurationEvent); Swordfish.destroyWindow(Swordfish.addXmlConfigurationWindow); - Swordfish.settingsWindow.focus(); + Swordfish.preferencesWindow.focus(); } else { Swordfish.showMessage({ type: 'error', message: data.reason, parent: 'addConfiguration' }); } diff --git a/ts/about.ts b/ts/about.ts index b456059..2708063 100644 --- a/ts/about.ts +++ b/ts/about.ts @@ -38,7 +38,7 @@ class About { }); setTimeout(() => { this.electron.ipcRenderer.send('set-height', { window: 'about', width: document.body.clientWidth, height: document.body.clientHeight }); - }, 200); + }, 150); document.getElementById('system').blur(); } diff --git a/ts/mtManager.ts b/ts/mtManager.ts index 20b435b..437a026 100644 --- a/ts/mtManager.ts +++ b/ts/mtManager.ts @@ -24,8 +24,8 @@ export class MTManager { readonly mtLanguages: any = { google: { - srcLangs: ["af", "ak", "am", "ar", "as", "ay", "az", "be", "bg", "bho", "bm", "bn", "bs", "ca", "ceb", "ckb", "co", "cs", "cy", "da", "de", "doi", "dv", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "fi", "fr", "fy", "ga", "gd", "gl", "gn", "gom", "gu", "ha", "haw", "he", "hi", "hmn", "hr", "ht", "hu", "hy", "id", "ig", "ilo", "is", "it", "iw", "ja", "jv", "jw", "ka", "kk", "km", "kn", "ko", "kri", "ku", "ky", "la", "lb", "lg", "ln", "lo", "lt", "lus", "lv", "mai", "mg", "mi", "mk", "ml", "mn", "mni-Mtei", "mr", "ms", "mt", "my", "ne", "nl", "no", "nso", "ny", "om", "or", "pa", "pl", "ps", "pt", "qu", "ro", "ru", "rw", "sa", "sd", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "st", "su", "sv", "sw", "ta", "te", "tg", "th", "ti", "tk", "tl", "tr", "ts", "tt", "ug", "uk", "ur", "uz", "vi", "xh", "yi", "yo", "zh", "zh-CN", "zh-TW", "zu"], - tgtLangs: ["af", "ak", "am", "ar", "as", "ay", "az", "be", "bg", "bho", "bm", "bn", "bs", "ca", "ceb", "ckb", "co", "cs", "cy", "da", "de", "doi", "dv", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "fi", "fr", "fy", "ga", "gd", "gl", "gn", "gom", "gu", "ha", "haw", "he", "hi", "hmn", "hr", "ht", "hu", "hy", "id", "ig", "ilo", "is", "it", "iw", "ja", "jv", "jw", "ka", "kk", "km", "kn", "ko", "kri", "ku", "ky", "la", "lb", "lg", "ln", "lo", "lt", "lus", "lv", "mai", "mg", "mi", "mk", "ml", "mn", "mni-Mtei", "mr", "ms", "mt", "my", "ne", "nl", "no", "nso", "ny", "om", "or", "pa", "pl", "ps", "pt", "qu", "ro", "ru", "rw", "sa", "sd", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "st", "su", "sv", "sw", "ta", "te", "tg", "th", "ti", "tk", "tl", "tr", "ts", "tt", "ug", "uk", "ur", "uz", "vi", "xh", "yi", "yo", "zh", "zh-CN", "zh-TW", "zu"] + srcLangs: ["ab", "ace", "ach", "af", "ak", "alz", "am", "ar", "as", "awa", "ay", "az", "ba", "ban", "bbc", "be", "bem", "bew", "bg", "bho", "bik", "bm", "bn", "br", "bs", "bts", "btx", "bua", "ca", "ceb", "cgg", "chm", "ckb", "cnh", "co", "crh", "crs", "cs", "cv", "cy", "da", "de", "din", "doi", "dov", "dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fj", "fr", "fy", "ga", "gaa", "gd", "gl", "gn", "gom", "gu", "ha", "haw", "he", "hi", "hil", "hmn", "hr", "hrx", "ht", "hu", "hy", "id", "ig", "ilo", "is", "it", "iw", "ja", "jv", "jw", "ka", "kk", "km", "kn", "ko", "kri", "ktu", "ku", "ky", "la", "lb", "lg", "li", "lij", "lmo", "ln", "lo", "lt", "ltg", "luo", "lus", "lv", "mai", "mak", "mg", "mi", "min", "mk", "ml", "mn", "mni-Mtei", "mr", "ms", "ms-Arab", "mt", "my", "ne", "new", "nl", "no", "nr", "nso", "nus", "ny", "oc", "om", "or", "pa", "pa-Arab", "pag", "pam", "pap", "pl", "ps", "pt", "qu", "rn", "ro", "rom", "ru", "rw", "sa", "scn", "sd", "sg", "shn", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "ss", "st", "su", "sv", "sw", "szl", "ta", "te", "tet", "tg", "th", "ti", "tk", "tl", "tn", "tr", "ts", "tt", "ug", "uk", "ur", "uz", "vi", "xh", "yi", "yo", "yua", "yue", "zh", "zh-CN", "zh-TW", "zu"], + tgtLangs: ["ab", "ace", "ach", "af", "ak", "alz", "am", "ar", "as", "awa", "ay", "az", "ba", "ban", "bbc", "be", "bem", "bew", "bg", "bho", "bik", "bm", "bn", "br", "bs", "bts", "btx", "bua", "ca", "ceb", "cgg", "chm", "ckb", "cnh", "co", "crh", "crs", "cs", "cv", "cy", "da", "de", "din", "doi", "dov", "dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fj", "fr", "fy", "ga", "gaa", "gd", "gl", "gn", "gom", "gu", "ha", "haw", "he", "hi", "hil", "hmn", "hr", "hrx", "ht", "hu", "hy", "id", "ig", "ilo", "is", "it", "iw", "ja", "jv", "jw", "ka", "kk", "km", "kn", "ko", "kri", "ktu", "ku", "ky", "la", "lb", "lg", "li", "lij", "lmo", "ln", "lo", "lt", "ltg", "luo", "lus", "lv", "mai", "mak", "mg", "mi", "min", "mk", "ml", "mn", "mni-Mtei", "mr", "ms", "ms-Arab", "mt", "my", "ne", "new", "nl", "no", "nr", "nso", "nus", "ny", "oc", "om", "or", "pa", "pa-Arab", "pag", "pam", "pap", "pl", "ps", "pt", "qu", "rn", "ro", "rom", "ru", "rw", "sa", "scn", "sd", "sg", "shn", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "ss", "st", "su", "sv", "sw", "szl", "ta", "te", "tet", "tg", "th", "ti", "tk", "tl", "tn", "tr", "ts", "tt", "ug", "uk", "ur", "uz", "vi", "xh", "yi", "yo", "yua", "yue", "zh", "zh-CN", "zh-TW", "zu"] }, azure: { srcLangs: ["af", "am", "ar", "as", "az", "ba", "bg", "bho", "bn", "bo", "brx", "bs", "ca", "cs", "cy", "da", "de", "doi", "dsb", "dv", "el", "en", "es", "et", "eu", "fa", "fi", "fil", "fj", "fo", "fr", "fr-CA", "ga", "gl", "gom", "gu", "ha", "he", "hi", "hne", "hr", "hsb", "ht", "hu", "hy", "id", "ig", "ikt", "is", "it", "iu", "iu-Latn", "ja", "ka", "kk", "km", "kmr", "kn", "ko", "ks", "ku", "ky", "ln", "lo", "lt", "lug", "lv", "lzh", "mai", "mg", "mi", "mk", "ml", "mn-Cyrl", "mn-Mong", "mni", "mr", "ms", "mt", "mww", "my", "nb", "ne", "nl", "nso", "nya", "or", "otq", "pa", "pl", "prs", "ps", "pt", "pt-PT", "ro", "ru", "run", "rw", "sd", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr-Cyrl", "sr-Latn", "st", "sv", "sw", "ta", "te", "th", "ti", "tk", "tlh-Latn", "tlh-Piqd", "tn", "to", "tr", "tt", "ty", "ug", "uk", "ur", "uz", "vi", "xh", "yo", "yua", "yue", "zh-Hans", "zh-Hant", "zu"], @@ -33,7 +33,7 @@ export class MTManager { }, deepl: { srcLangs: ["bg", "cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "hu", "id", "it", "ja", "ko", "lt", "lv", "nb", "nl", "pl", "pt", "ro", "ru", "sk", "sl", "sv", "tr", "uk", "zh"], - tgtLangs: ["bg", "cs", "da", "de", "el", "en-GB", "en-US", "es", "et", "fi", "fr", "hu", "id", "it", "ja", "ko", "lt", "lv", "nb", "nl", "pl", "pt-BR", "pt-PT", "ro", "ru", "sk", "sl", "sv", "tr", "uk", "zh-Hans"] + tgtLangs: ["bg", "cs", "da", "de", "el", "en-GB", "en-US", "es", "et", "fi", "fr", "hu", "id", "it", "ja", "ko", "lt", "lv", "nb", "nl", "pl", "pt-BR", "pt-PT", "ro", "ru", "sk", "sl", "sv", "tr", "uk", "zh", "zh-Hans"] }, modernmt: { srcLangs: ["ace", "af", "ak", "als", "am", "ar", "as", "ast", "awa", "ayr", "az", "azb", "azj", "ba", "ban", "be", "bem", "bg", "bho", "bjn", "bm", "bn", "bo", "bs", "bug", "ca", "ceb", "cjk", "ckb", "crh", "cs", "cy", "da", "de", "dik", "diq", "dyu", "dz", "ee", "el", "en", "eo", "es", "es-419", "es-ES", "et", "fi", "fj", "fo", "fon", "fr", "fur", "fuv", "ga", "gaz", "gd", "gl", "gn", "gu", "ha", "he", "hi", "hne", "hr", "ht", "hu", "hy", "id", "ig", "ilo", "is", "it", "ja", "jv", "ka", "kab", "kac", "kam", "kas", "kbp", "kea", "kg", "khk", "ki", "kk", "km", "kmb", "kmr", "kn", "knc", "ko", "ks", "ky", "la", "lb", "lg", "li", "lij", "lmo", "ln", "lo", "lt", "ltg", "lua", "luo", "lus", "lv", "lvs", "mag", "mai", "mg", "mi", "min", "mk", "ml", "mn", "mni", "mos", "mr", "ms", "mt", "my", "nb", "ne", "nl", "nn", "nso", "nus", "ny", "oc", "or", "pa", "pag", "pap", "pbt", "pes", "pl", "plt", "prs", "ps", "pt", "pt-BR", "pt-PT", "quy", "rn", "ro", "ru", "rw", "sa", "sat", "sc", "scn", "sd", "sg", "shn", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "ss", "st", "su", "sv", "sw", "szl", "ta", "taq", "te", "tg", "th", "ti", "tk", "tl", "tn", "tpi", "tr", "ts", "tt", "tum", "tw", "tzm", "ug", "uk", "umb", "ur", "uzn", "vec", "vi", "war", "wo", "xh", "ydd", "yo", "zh", "zh-CN", "zh-TW", "zsm", "zu"], diff --git a/ts/preferences.ts b/ts/preferences.ts index fbf3fd5..e6fc09b 100644 --- a/ts/preferences.ts +++ b/ts/preferences.ts @@ -25,6 +25,7 @@ class Preferences { fuzzyTermSearches: boolean; caseSensitiveSearches: boolean; caseSensitiveMatches: boolean; + autoConfirm: boolean; google: { enabled: boolean; apiKey: string; @@ -61,4 +62,5 @@ class Preferences { }; os: string; showGuide: boolean; + pageRows: number; } \ No newline at end of file diff --git a/ts/preferencesDialog.ts b/ts/preferencesDialog.ts index 9e91800..4a75bf6 100644 --- a/ts/preferencesDialog.ts +++ b/ts/preferencesDialog.ts @@ -14,6 +14,8 @@ class PreferencesDialog { electron = require('electron'); + static readonly defaultWidth: number = 640; + tabHolder: TabHolder; spellcheckTab: Tab; @@ -32,6 +34,7 @@ class PreferencesDialog { fuzzyTermSearches: HTMLInputElement; caseSensitiveTermSearches: HTMLInputElement; caseSensitiveMatches: HTMLInputElement; + autoConfirm: HTMLInputElement; enableGoogle: HTMLInputElement; googleKey: HTMLInputElement; @@ -64,16 +67,21 @@ class PreferencesDialog { os: string; showGuide: boolean; + pageRows: HTMLInputElement; + filtersTable: HTMLTableElement; selected: Map; constructor() { + + document.body.classList.add("wait"); + this.tabHolder = new TabHolder(document.getElementById('main') as HTMLDivElement, "preferencesHolder"); let basicTab: Tab = new Tab('basicTab', 'Basic', false); basicTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); this.tabHolder.addTab(basicTab); @@ -82,7 +90,7 @@ class PreferencesDialog { let mtTab: Tab = new Tab('mtTab', 'Machine Translation', false); mtTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); this.tabHolder.addTab(mtTab); @@ -91,7 +99,7 @@ class PreferencesDialog { this.spellcheckTab = new Tab('spellcheckTab', 'Spellchecker', false); this.spellcheckTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); this.tabHolder.addTab(this.spellcheckTab); @@ -99,7 +107,7 @@ class PreferencesDialog { let advancedTab: Tab = new Tab('advancedTab', 'Advanced', false); advancedTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); this.tabHolder.addTab(advancedTab); @@ -108,7 +116,6 @@ class PreferencesDialog { this.tabHolder.selectTab('basicTab'); this.electron.ipcRenderer.send('get-theme'); - this.electron.ipcRenderer.send('get-languages'); this.electron.ipcRenderer.on('set-languages', (event: Electron.IpcRendererEvent, arg: any) => { this.setLanguages(arg); }); @@ -167,7 +174,7 @@ class PreferencesDialog { this.setFilters(arg); }); setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); } @@ -186,6 +193,7 @@ class PreferencesDialog { this.fuzzyTermSearches.checked = preferences.fuzzyTermSearches; this.caseSensitiveTermSearches.checked = preferences.caseSensitiveSearches; this.caseSensitiveMatches.checked = preferences.caseSensitiveMatches; + this.autoConfirm.checked = preferences.autoConfirm; this.enableGoogle.checked = preferences.google.enabled; this.googleKey.value = preferences.google.apiKey; @@ -251,7 +259,10 @@ class PreferencesDialog { this.os = preferences.os; this.showGuide = preferences.showGuide; + this.pageRows.value = preferences.pageRows.toString(); this.populateSpellcheckTab(this.spellcheckTab.getContainer(), preferences.spellchecker); + + this.electron.ipcRenderer.send('preferences-set'); } setLanguages(arg: any): void { @@ -260,10 +271,14 @@ class PreferencesDialog { this.srcLangSelect.innerHTML = languageOptions; this.tgtLangSelect.innerHTML = languageOptions; - this.electron.ipcRenderer.send('get-mt-languages'); + this.electron.ipcRenderer.send('get-preferences'); } savePreferences(): void { + if (this.pageRows.valueAsNumber < 100 || this.pageRows.valueAsNumber > 2000) { + this.electron.ipcRenderer.send('show-message', { type: 'warning', message: 'Set a number of rows per page between 100 and 2000', parent: 'preferences' }); + return; + } if (this.enableGoogle.checked && this.googleKey.value === '') { this.electron.ipcRenderer.send('show-message', { type: 'warning', message: 'Enter Google API key', parent: 'preferences' }); return; @@ -319,6 +334,7 @@ class PreferencesDialog { fuzzyTermSearches: this.fuzzyTermSearches.checked, caseSensitiveSearches: this.caseSensitiveTermSearches.checked, caseSensitiveMatches: this.caseSensitiveMatches.checked, + autoConfirm: this.autoConfirm.checked, google: { enabled: this.enableGoogle.checked, apiKey: this.googleKey.value, @@ -354,7 +370,8 @@ class PreferencesDialog { defaultSpanish: 'es' }, os: this.os, - showGuide: this.showGuide + showGuide: this.showGuide, + pageRows: this.pageRows.valueAsNumber } if (this.os !== 'darwin') { prefs.spellchecker = { @@ -438,7 +455,8 @@ class PreferencesDialog { this.themeColor.id = 'themeColor'; this.themeColor.innerHTML = '' + '' + - '' + '' + + ''; td.appendChild(this.themeColor); tr = document.createElement('tr'); @@ -465,8 +483,35 @@ class PreferencesDialog { '' + '' + '' + - '' + ''; td.appendChild(this.zoomFactor); + + tr = document.createElement('tr'); + langsTable.appendChild(tr); + + td = document.createElement('td'); + td.classList.add('middle'); + td.classList.add('noWrap'); + tr.appendChild(td); + + let rowsLabel: HTMLLabelElement = document.createElement('label'); + rowsLabel.setAttribute('for', 'pageRows'); + rowsLabel.innerText = 'Rows per Page'; + td.appendChild(rowsLabel); + + td = document.createElement('td'); + td.classList.add('middle'); + tr.appendChild(td); + + this.pageRows = document.createElement('input'); + this.pageRows.id = 'pageRows'; + this.pageRows.type = 'number'; + this.pageRows.min = '100'; + this.pageRows.max = '2000'; + this.pageRows.step = '100'; + this.pageRows.style.width = this.zoomFactor.clientWidth + 'px'; + td.appendChild(this.pageRows); + } populateSpellcheckTab(container: HTMLDivElement, spellchecker: any): void { @@ -596,7 +641,7 @@ class PreferencesDialog { let generalTab: Tab = new Tab('generalTab', 'General', false); generalTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); advHolder.addTab(generalTab); @@ -605,7 +650,7 @@ class PreferencesDialog { let xmlTab: Tab = new Tab('xmlTab', 'XML Filter', false); xmlTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); advHolder.addTab(xmlTab); @@ -812,6 +857,23 @@ class PreferencesDialog { caseSensitiveMatchesLabel.setAttribute('for', 'caseSensitiveMatches'); caseSensitiveMatchesLabel.style.marginTop = '4px'; row5.appendChild(caseSensitiveMatchesLabel); + + let row6: HTMLDivElement = document.createElement('div'); + row6.classList.add('row'); + row6.classList.add('middle'); + container.appendChild(row6); + + this.autoConfirm = document.createElement('input'); + this.autoConfirm.type = 'checkbox'; + this.autoConfirm.id = 'autoConfirm'; + row6.appendChild(this.autoConfirm); + + let autoConfirmLabel: HTMLLabelElement = document.createElement('label'); + autoConfirmLabel.innerText = 'Automatically Confirm Propagated Segments'; + autoConfirmLabel.setAttribute('for', 'autoConfirm'); + autoConfirmLabel.style.marginTop = '4px'; + row6.appendChild(autoConfirmLabel); + } populateXmlFilterTab(container: HTMLDivElement): void { @@ -919,7 +981,7 @@ class PreferencesDialog { let googleTab: Tab = new Tab('googleTab', 'Google', false); googleTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); mtHolder.addTab(googleTab); @@ -928,7 +990,7 @@ class PreferencesDialog { let azureTab: Tab = new Tab('azureTab', 'Microsoft Azure', false); azureTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); mtHolder.addTab(azureTab); @@ -937,7 +999,7 @@ class PreferencesDialog { let deeplTab: Tab = new Tab('deeplTab', 'DeepL', false); deeplTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); mtHolder.addTab(deeplTab); @@ -946,7 +1008,7 @@ class PreferencesDialog { let chatGptTab: Tab = new Tab('chatGptTab', 'ChatGPT', false); chatGptTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); mtHolder.addTab(chatGptTab); @@ -955,7 +1017,7 @@ class PreferencesDialog { let modernmtTab: Tab = new Tab('modernmtTab', 'ModernMT', false); modernmtTab.getLabelDiv().addEventListener('click', () => { setTimeout(() => { - this.electron.ipcRenderer.send('set-height', { window: 'settings', width: document.body.clientWidth, height: document.body.clientHeight }); + this.electron.ipcRenderer.send('set-height', { window: 'preferences', width: PreferencesDialog.defaultWidth, height: document.body.clientHeight }); }, 200); }); mtHolder.addTab(modernmtTab); @@ -1294,7 +1356,8 @@ class PreferencesDialog { this.googleSrcLang.innerHTML = this.getOptions(arg.google.srcLangs); this.googleTgtLang.innerHTML = this.getOptions(arg.google.tgtLangs); - this.electron.ipcRenderer.send('get-preferences'); + this.electron.ipcRenderer.send('get-languages'); + document.body.classList.remove("wait"); } getOptions(array: any[]): string { diff --git a/ts/tabs.ts b/ts/tabs.ts index 8372194..58b0e72 100644 --- a/ts/tabs.ts +++ b/ts/tabs.ts @@ -97,6 +97,7 @@ class TabHolder { tabs: Map; closeable: Map; tabsHolder: HTMLDivElement; + filler: HTMLDivElement; contentHolder: HTMLDivElement; tabsList: string[] = []; @@ -109,6 +110,10 @@ class TabHolder { this.tabsHolder = document.createElement('div'); this.tabsHolder.classList.add('tabHolder'); + this.filler = document.createElement('div'); + this.filler.style.flex = '1'; + this.filler.classList.add('tab'); + this.tabsHolder.appendChild(this.filler); parent.appendChild(this.tabsHolder); this.contentHolder = document.createElement('div'); @@ -137,7 +142,7 @@ class TabHolder { addTab(tab: Tab): void { tab.setParent(this); - this.tabsHolder.appendChild(tab.getLabelDiv()); + this.tabsHolder.insertBefore(tab.getLabelDiv(), this.filler); this.labels.set(tab.getId(), tab.getLabelDiv()); this.contentHolder.appendChild(tab.getContainer()); this.tabs.set(tab.getId(), tab); diff --git a/ts/translation.ts b/ts/translation.ts index 069ab49..d0c940d 100644 --- a/ts/translation.ts +++ b/ts/translation.ts @@ -126,11 +126,12 @@ class TranslationView { notesVisible: boolean = false; - constructor(tab: Tab, projectId: string, sourceLang: string, targetLang: string) { + constructor(tab: Tab, projectId: string, sourceLang: string, targetLang: string, rows: number) { this.container = tab.getContainer(); this.projectId = projectId; this.srcLang = sourceLang; this.tgtLang = targetLang; + this.rowsPage = rows; this.sourceTags = new Map(); this.topBar = document.createElement('div'); @@ -1558,9 +1559,16 @@ class TranslationView { && row.getAttribute('data-id') === data.segment) { (row.getElementsByClassName('match')[0] as HTMLTableCellElement).innerHTML = data.match + '%'; if (data.target) { + let status : string = data.status; (row.getElementsByClassName('state')[0] as HTMLTableCellElement).classList.remove('initial'); - (row.getElementsByClassName('state')[0] as HTMLTableCellElement).classList.add('translated'); + (row.getElementsByClassName('state')[0] as HTMLTableCellElement).classList.add(status); (row.getElementsByClassName('target')[0] as HTMLTableCellElement).innerHTML = data.target; + if (data.status === 'translated') { + (row.getElementsByClassName('state')[0] as HTMLTableCellElement).innerHTML = TranslationView.TRANSLATED_SPAN; + } + if (data.status === 'final') { + (row.getElementsByClassName('state')[0] as HTMLTableCellElement).innerHTML = TranslationView.FINAL_SPAN; + } } break; }